-
-
Notifications
You must be signed in to change notification settings - Fork 586
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
default language fallback not working #575
Comments
Hi, any answer to this request? I face the same problem: translate.setDefaultLang('en'); basically I want to read the browsers language and use this language for my translations (this works smoothly!) but as I live in Switzerland a lot of Browsers are set co DE-CH which is not supported by my translation files so the translations will obviously fail. For this I want to set a Fallback language (de or en whatever) which translates all the missing keys. thanks for your help |
Gotnalso the Same Problem. Anyway News Here? |
I also faced same issue. In my case there was an extra comma in en.json file, which made it invalid. It's always better to clone working example and compare if there error or not. Fallback worked perfectly in example, so I examined my code and found a typo. |
I am facing the same issue. For now i am using the @Beni90 workarund but both languages are not always loaded. Any news in a fix?
|
We are also facing this problem. Application provides support for a dozen of languages, with |
In my case, my app have 2 languages: English and Vietnamese, so I only create a translation for VIetnamese (./assets/i18n/vi.json) and set default language is English. app.modules.ts
Please noted that I use LazyTranslateLoader, not HttpLoaderFactory like example of ngx-translate Usage, because I did not create app.component.ts
In Setting screen, I could switch language simply with an ion-toggle element (or somethings else) without any errors
|
I'm submitting a ... (check one with "x")
Given
Default language is set to a certain default language. This default file provides all keys.
One available language is en-US. This language provides all keys.
Current language is set to de-DE. de-DE provides most, but not all keys.
Current behavior
When a translation for a key is requested which is not available in de-DE, the KEY is displayed.
Expected/desired behavior
When a translation is requested for a key that is missing in the current language, the VALUE of the key from the DEFAULT language should be displayed.
Reproduction of the problem
See this plunkr: http://plnkr.co/edit/W80lvlrhOTS3Sf1NU43U?p=preview
The languages are put into language specific folders, and the default file is located at the i18n directory to act as the global fallback.
What is the expected behavior?
When a key is not present in one of the two languages, the fallback value from the default file i18n/translation.json should be displayed.
What is the motivation / use case for changing the behavior?
Falling back to the default language should be the default for keys that are not translated.
Please tell us about your environment:
The text was updated successfully, but these errors were encountered: