-
-
Notifications
You must be signed in to change notification settings - Fork 520
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
Fallback bug #460
Comments
Do you know how ruby's |
@PikachuEXE, I have no idea. I reported this issue because I'm using react-native-i18n which depends on this library and I encountered this issue. I'm not sure whether anyone else encountered this issue in i18n-js too. I want to provide |
OK let me check the logic from Ruby's I18n and see how it handle this case Let me get back to you later |
@xareelee @PikachuEXE thanks a lot. Same here i am also using it with react-native-i18n and for me it does not work even though we just want to support the simplified chinese "zh-Hans". Would be awesome to fix the logic here. |
https://github.com/fnando/i18n-js/blob/master/app/assets/javascripts/i18n.js#L273 here it takes only first element "zh" from 3 elements ["zh","hans","tw"], logic here should be changed, it should add "zh" and "zh-hans". |
yes. i think there is a more semantic way to achieve what is done there. Anyone here that is interested and has already worked with this lib? I think it makes sense to improve this part with a PR? |
Please take a look at #465 to see if it works |
I forward this issue from AlexanderZaytsev/react-native-i18n#96 (comment).
The fallback strategy has a bug. The Chinese mandarin language (zh/中, how to pronounce) use a character system (Han/漢, how to write) which is divided into two kinds of symbol styles: Traditional Chinese characters (zh-Hant, where t stands for Traditional) and Simplified Chinese characters (zh-Hans, where s stands for Simplified).
For example, a user uses Traditional Chinese characters and lives in Taiwan, his language and locale should be
zh-Hant-TW
, and the priority of the i18n fallback strategy should be:zh-Hant-TW
: Traditional Chinese characters used in Taiwanzh-Hant
: general Traditional Chinese characterszh
: general Chinese charactersThe current fallback strategy of
i18n-js
has a bug. If it doesn't findzh-Hant-TW
, it will only look forzh
, notzh-Hant
first.I want to provide
zh-Hant
for all Traditional Chinese andzh-Hans
for all Simplified Chinese no matter what the locale is, but it can't currently work. Devices providelang+locale
andi18n-js
fallbacks tozh
directly in this scenario.Fallback strategy:
zh-Hant-TW
->zh-Hant
->zh
-> default languagezh-Hant-TW
->zh
-> default languageThe text was updated successfully, but these errors were encountered: