Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Trans component ignore default options #818

Closed

Conversation

yashigani
Copy link

@yashigani yashigani commented Apr 5, 2019

react-i18next has some default options but Trans component ignore it.
Reproduce it project: https://codesandbox.io/s/1zxox032q

@coveralls
Copy link

coveralls commented Apr 5, 2019

Coverage Status

Coverage increased (+0.4%) to 93.966% when pulling e8a40ac on yashigani:fix-ignore-default-options into 4fc5360 on i18next:master.

@jamuhl
Copy link
Member

jamuhl commented Apr 5, 2019

Hm...now you ignore the passed in options

if need defaults + passed in it should be:

init(instance) {
    setDefaults({ ...getDefaults(), ...instance.options.react});	    
    setI18n(instance);
  },
};

@yashigani
Copy link
Author

yashigani commented Apr 5, 2019

I seem setDefaults method merge options into defaultOptions.

export function setDefaults(options = {}) {
  defaultOptions = { ...defaultOptions, ...options };
}

@jamuhl
Copy link
Member

jamuhl commented Apr 5, 2019

right...i see now what you mean...the Trans component also takes stuff from i18nextOptions directly...for cases passed in i18n via props but using "setDefaults" does not change your options...

guess will merge options in Trans...please keep this open...will provide a fix asap

@jamuhl
Copy link
Member

jamuhl commented Apr 8, 2019

should be fixed in react-i18next@10.6.2

@jamuhl jamuhl closed this Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants