-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
i18n.exists not working with nsMode fallback #1687
Comments
there is a big difference between calling calling you will have to call |
@jamuhl Thanks for the response. If I check How do I make it do that by default, similar to passing I don't want to explicitly reference My setup is basically something like this: <I18nextProvider i18n={i18n} defaultNS={['Ans', 'sharedNs']}>
<A />
</I18nextProvider>
<I18nextProvider i18n={i18n} defaultNS={['Bns', 'sharedNs']}>
<B />
</I18nextProvider> The component where I do the exists check is used in both A and B, so namespace should not be fixed. Thank you! EDIT: Of course another solution is to just use |
Any update on this? is it my fault? I've resorted to checking if t returns the defaultValue (empty string) and then I know if value exists or not, but it would be cleaner if exists function worked with multiple namespaces.. or maybe I'm doing something wrong? |
nothing wrong...just like said before beside that not even sure what the benefit of checking exist before calling t is useful for? |
🐛 Bug Report
i18n.exists does not fallback to other namespaces if key is not found, while t does.
It does seem to fetch from the fallbackNS set in the config, but does not use the default namespaces given to the provider.
To Reproduce
Config:
Provider:
Usage:
Expected behavior
Should work same as
t
which knows to fallback to second default namespace since nsMode is fallback.Your Environment
The text was updated successfully, but these errors were encountered: