fix i18n in a situation where navigator.languages=[]
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
229eef4624
commit
c614c03b03
1 changed files with 3 additions and 3 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue