-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Map i18next language code to ICU locale #35
Comments
not 100% what you're requesting... locales codes are defined like in ICU:
|
Thank you. I wasn't aware of the x-custom part, which gives me exactly what I need. |
Maybe this is a somewhat unrelated question, but might be still worth asking in the same thread. Sorry if this is off-topic 🙏 Is it possible to map the rules of a completely different language id into a known one, e.g. English? I’d like to set up a new locale with id When I go for
Is there any way I can tell Replacing |
@kachkaev hm...only option I could think of is adding some parseLngForICU function here: https://github.com/i18next/i18next-icu/blob/master/src/index.js#L66 what do you think? Doable? Practical? PR welcome |
Thanks for your reply @jamuhl, the idea makes sense! I’ll submit a PR within a few weeks unless we decide to replace |
Our team had need of this too, so I made a PR: #63 |
🚀 Feature Proposal
I propose adding a way of mapping from the i18next language code to another code.
Motivation
There may be a case where multiple sets of translations are required for the same language. For example, if a web app is deployed to multiple companies, each company may need their own company-specific set of translations, even though they're still using the same underlying language and locale.
At the moment I'm partially getting around this by using multiple custom region suffices, with the appropriate language code. e.g. en-ab, en-en, en-xy. This ensures that the correct plural forms are used. Unfortunately it ends up causing the wrong date formats to use, as they are based on the second part of the code.
It would be useful to be able to have resource packs named with arbitrary names, e.g. bobswidgets, sparklythings, default, and then be able to have a function which maps those names to correct locales. Or perhaps to use the modified codes as before (en-ab, en-en, en-xy) and map them to real locales (en-gb).
Although I particularly need this for i18next-icu, it may actually make sense to implement it in the main i18next package.
The text was updated successfully, but these errors were encountered: