-
-
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
Support for fallback language #393
Comments
Hey - here is how we do it: In our root component's ngOnInit we have the following logic: const langs = [
'en-GB',
'de'
];
let isSupported = langs.find(supportedLanguage => supportedLanguage === navigator.language);
if (isSupported) {
this.translate.use(navigator.language);
}
else {
this.translate.use('en-GB');
} |
I'd expect the same behavior to be provided. It seems it isn't available. @SamFarrington This won't fall back to the specific language. Think about |
The fallback language support was excellent in angular-translate. There should be a stack or chain of fallback languages |
Are there any plans to get this feature in near future? |
Any update on this? |
I don't know if you offer a way to vote for enhancements, but this would be my #1 request as well :) |
@jstoup111 Did you ever find a solution for this? I am facing the same issue. |
I did not and have been off the project that I needed this in for quite awhile now. It might be best to keep a reference to each language you support and then just split the string if it doesn't find it in the set.
I haven't used this package in a long time so the code above likely needs some love, but the concept should work great. |
Thanks, that is almost exactly what I ended up doing. |
I wasn't able to find this is the docs or on the internet. Is there a way to have the translation fallback to the standard language if it can't find a dialect?
I.E
I have a
en.json
file. When I retrieve the locale, I'd like to set it and have it fall back to the language if it can't find the dialect.en-US
&en-GB
&en-UK
should fall back toen.json
if the file doesn't exist.fr-CA
should fallback tofr.json
and then whatever I specified as default if it doesn't findfr.json
Is this how the library works, and if not how can I get it to function this way?
The text was updated successfully, but these errors were encountered: