You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[x] bug report => check the FAQ and search github for a similar issue or PR before submitting
[ ] support request => check the FAQ and search github for a similar issue before submitting
[ ] feature request
Current behavior
I use the following two calls to set the current language to French and the default (fallback) language to English.
So if a translation is missing from the French translations file, it should fall back to the English translations file. This is not the case though.
The use function successfully adds the French translations, but the setDefaultLang is not adding the English translations. The English translations should even be the default (making the setDefaultLang call even unnecessary). I have also tried to call the addLangs function, but this is not working either.
Expected/desired behavior
I would like ng2-translate to load in all the translation files inside the i18n directory automatically to so that I wouldn't even have to use the use function and let the browser of the client decide which translations to try and use (falling back to the fallback language if it is not available).
I would expect that the "en.json" to be injected by default (unless specified otherwise by setDefaultLang) and I would also expect that the setDefaultLang to inject the given translations file.
Lastly (but I am not sure if this is according to what it is supposed to do) I would expect the addLangs function to inject the given translations. But I don't think that a list of available languages is something that ng2-translate 'should' be tracking anyway.
Reproduction of the problem
If the current behavior is a bug or you can illustrate your feature request better with an example, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:btpW3l0jr5beJVjohy1Q).
What is the motivation / use case for changing the behavior?
The fallback language does not work unless the use function is called for it.
Please tell us about your environment:
Angular 2 v2.2.1 (also tried v2.2.2) with Webpack. But it is reproducible in other environments (check the Plunker linked above using your given starting point).
ng2-translate version:
latest (v4.0.1)
Angular version:
v2.2.1 / v2.2.2
Browser:
Chrome
Language:
TS
The text was updated successfully, but these errors were encountered:
If anyone faces the same issue. A simple workaround is doing a use for the fallback language before setting it to the initial language (e.g. browser's language):
I'm submitting a ... (check one with "x")
Current behavior
I use the following two calls to set the current language to French and the default (fallback) language to English.
So if a translation is missing from the French translations file, it should fall back to the English translations file. This is not the case though.
The use function successfully adds the French translations, but the setDefaultLang is not adding the English translations. The English translations should even be the default (making the setDefaultLang call even unnecessary). I have also tried to call the addLangs function, but this is not working either.
Expected/desired behavior
I would like ng2-translate to load in all the translation files inside the i18n directory automatically to so that I wouldn't even have to use the use function and let the browser of the client decide which translations to try and use (falling back to the fallback language if it is not available).
I would expect that the "en.json" to be injected by default (unless specified otherwise by setDefaultLang) and I would also expect that the setDefaultLang to inject the given translations file.
Lastly (but I am not sure if this is according to what it is supposed to do) I would expect the addLangs function to inject the given translations. But I don't think that a list of available languages is something that ng2-translate 'should' be tracking anyway.
Reproduction of the problem
If the current behavior is a bug or you can illustrate your feature request better with an example, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:btpW3l0jr5beJVjohy1Q).
http://plnkr.co/edit/4M7kUf0H8utxrF7bNskL?p=preview
What is the motivation / use case for changing the behavior?
The fallback language does not work unless the use function is called for it.
Please tell us about your environment:
Angular 2 v2.2.1 (also tried v2.2.2) with Webpack. But it is reproducible in other environments (check the Plunker linked above using your given starting point).
ng2-translate version:
latest (v4.0.1)
Angular version:
v2.2.1 / v2.2.2
Browser:
Chrome
Language:
TS
The text was updated successfully, but these errors were encountered: