I have a method that returns either german or english. Works perfectly on Google Chrome but on IE it always return english.
What is the issue? How can I support IE with my code?
// Method that returns the locale to be used in the translation e.g. en, de
this.getLocale = function() {
var locale = window.navigator.language;
console.log(locale);
// Only get the first two letters of the locale e.g. en-US -> en, pt-PT -> pt
locale = locale.substr(0, 2);
// Return en or de. Defaults as en
return (locale == "en" || locale == "de") ? locale : "en";
};
My browser is in German, my computer is in German.
The I18n labels is in German but window.navigator.language
returns en-US. How is this possible?