Add `fallbackLocale`
See original GitHub issueApparently the baseLocale
option was removed for ember-intl@3
, but this seemed like a quite useful option, which prevented users from seeing “missing translation” and instead at least showing e.g. the english version of the thing.
I agree that baseLocale
as a way to determine whether translations are missing was not ideal and it’s good that that part got refactored, but I think having such a fallbackLocale
option would still be valuable to a lot of projects.
@jasonmit are you open to bringing back such an option?
Issue Analytics
- State:
- Created 5 years ago
- Comments:22 (12 by maintainers)
Top Results From Across the Web
Fallback localization | Vue I18n
Explicit fallback with an array of locales. It is possible to set more than one fallback locale by using an array of locales....
Read more >Question - How to add a Fallback Locale - Unity Forum
Can you try updating to 1.3.2? You may need to manually edit the manifest.json file in the Packages folder to change the version....
Read more >Fallback - i18next documentation
add pure lang. const langPart = code.split('-')[0];. if (langPart !== code) fallbacks.push(langPart);. . // finally, developer language.
Read more >Class FallbackLocale | Localization | 0.5.1-preview
The Locale to fall back to when searching for a localized value. When assigning a new value, it will be checked to ensure...
Read more >Supported Locales and Fallback Chain - SAPUI5 SDK
You can configure a list of supported locales and a fallback locale in your ... Only use the supportedLocales feature if you are...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jacobq thank you for the feedback.
I’m not against bringing back fallback locale where at build time we do a deep merge of the fallback locale and against every locale’s translation object.
I think it would be a relatively easy feature to bring back and could land as part of the current 4.0 beta.
FWIW, I have a use case for having a fallback (permanent default) locale that I don’t think has been mentioned here yet. I have a number of “locale-less” strings, which are actually IDs like
company_1
that should be translated to the same thing in every locale (say, “Google”).In
ember-i18n
I was able to provide translation files injs
rather than JSON so could just merge those shared values into every translation file, butember-intl
doesn’t seem to offer a way to do this. Now it seems that I either need to duplicate these all over the place (not acceptable), generate the translation files with some other tools (e.g. write a little script to do the merging), or wrap access to the setter forlocale
(e.g. there is a select element that allows the user to change the language/locale) to ensure that it is always in array form and includes the default locale (perhapsen
or perhaps a customcommon
one, if allowed). This seems like a lot more fuss than necessary to me. Is there another approach that I should be using instead? (e.g. trying to handle this in the missing translation hook)