fix i18n in a situation where navigator.languages=[]

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2017-05-29 19:58:18 +01:00
parent 229eef4624
commit c614c03b03

View file

@ -87,10 +87,10 @@ export function getAllLanguageKeysFromJson() {
}
export function getLanguagesFromBrowser() {
if (navigator.languages) return navigator.languages;
if (navigator.language) return [navigator.language]
if (navigator.languages && navigator.languages.length) return navigator.languages;
if (navigator.language) return [navigator.language];
return [navigator.userLanguage];
};
}
/**
* Turns a language string, normalises it,