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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing ns
to config sets the defaultNS
to the first item in the array
#1658
Comments
This was intended, but not aware of someone defining the default "translation" namespace in ns option but not in defaultNS option. |
just to make it more clear:
|
I'm not sure I understand your point. In my head the issue doesn't seem to be that {
resources: {
en: { ns2, translation }
},
ns: ["ns2"],
} If you check the example on codesanbox, version v21.0.2 didn't change anything |
either don't set ns in i18n options, or set defaultNS too |
Ok, it feels like an odd behaviour. But if that is intended, then can we have it documented on the configuration options? |
What is odd? You pass in a namespace array in options only containing |
Mainly because you have two config variables that sort of interact with each other. It is not a big problem now it is documented though. Previously you could use the |
@adrai thanks, I think that makes things clearer in case someone falls on this. 馃憤 |
馃挜 Regression Report
Whenever you pass the
ns
option when initialising thei18next
instance, it sets thedefaultNS
to the first item in thens
array. Which meansuseTranslation()
without any namespace returns the wrong values.I'm using the React nomeclature here, but I'm fairly sure this issue is in the default package, since
react-i18next
didn't change, and you can see thedefaultNS
is set when using thedebug
option.Last working version
Worked up to version: 20.6.1
Stopped working in version: 21.0.1
To Reproduce
Steps to reproduce the behavior:
Check the sandbox, in the file
src/i18n.ts
we init the library, if we passns
to it, the first item in the array will become thedefaultNS
.https://codesandbox.io/s/i18next-cant-use-multiple-namespaces-r6li9
Expected behavior
I was expecting the previous behaviour, where
ns
was not tied todefaultNS
, if this is an intended change then it should be documented on docs and migration.The text was updated successfully, but these errors were encountered: