question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add `fallbackLocale`

See original GitHub issue

Apparently 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:closed
  • Created 5 years ago
  • Comments:22 (12 by maintainers)

github_iconTop GitHub Comments

3reactions
jasonmitcommented, Nov 20, 2018

@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.

2reactions
jacobqcommented, Nov 20, 2018

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 in js rather than JSON so could just merge those shared values into every translation file, but ember-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 for locale (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 (perhaps en or perhaps a custom common 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)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found