-
-
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
fixed graceful fallback for keys #1010
Conversation
Instead of patching around getting a fallback from an array - shouldn't you fix the problem of accessing |
We are using a dictionary whose value is [key, defaultMessage] for default language and json via xhr for others, which is similar to Message Descriptor in react intl |
just your fix is https://github.com/i18next/react-i18next/pull/1010/files#diff-d5c6a91c6c8060c38a8b3541ef38332fR20 if (!i18n) ---> this is a mistake in your app that needs a fix ... not a patch either set i18n via |
ok will close |
@ywongau look we can merge this - does not hurt - just configuring your application correctly you should never get into that code section where |
Thanks, now reopened :) |
published in react-i18next@11.2.5 If you like this module don’t forget to star this repo. Make a tweet, share the word or have a look at our https://locize.com to support the devs of this project. If you liked my support / work - I would enjoy a coffee sponsored using the “:purple_heart:Sponsor Button”. There are many ways to help this project 🙏 |
t accepts an array of keys and will use first resolved key or fallback to the last key https://www.i18next.com/overview/api#t
But when i18next instance is not ready useTranslation hook simply returns an identity function, t(['doh', 'Human friendly fallback']) gives me ['doh', 'Human friendly fallback'] instead of 'Human friendly fallback'