2
votes

Hi I can see there is a way in ngx-translate to provide default language as shown below

this.translate.setDefaultLang('en');

But I want to set different fallback language like:

en-US, en-IN & en-UK should fall back to en.json if the file doesn't exist. fr-CA should fallback to fr.json and then whatever I specified as default if it doesn't find fr.json

I was unable to find a way ngx-translate provide to solve this until we handle it logically.

If someone knows a way ngx-translate provide, please let me know.

1

1 Answers

0
votes

translate.setDefault(..) is setting the fallback language, so you are already using the fallback

To set the used language, if available, set it with translate.use(..).

To use a fallback with custom name, like "en-US", try to create the appropriate en-US.json translation file with translations. But this could produce compatibility problems since documentation only states to use "en" format