I have set up ng2-translate which translates my entire app and I have an en-GB.json file which contains all of my translations. The problem I have now is that if the user’s device is set to another language (e.g. ‘en-US’), I get 404 errors saying that the file en-US.json doesn’t exist.
Oh okay, try i think the problem is when you set up language.
I have this in a project :
var userLang = navigator.language.split('-')[0]; // use navigator lang if available
userLang = /(fr|en)/gi.test(userLang) ? userLang : 'en';
translate.setDefaultLang('en');
translate.use(userLang);
But i remove what is behind the char “-” in the language. So i only have files : en.json & fr.json here.
However i have a regex to test if i have a file for fr or gb and if i don’t have the user language, i setup userLang to en (defaultLang).