diff --git a/src/runtime/web/index.js b/src/runtime/web/index.js index 4c4432e9..f97e642e 100644 --- a/src/runtime/web/index.js +++ b/src/runtime/web/index.js @@ -25,7 +25,15 @@ documentReady().then(() => { }); function createLocalization(name, resIds, defaultLang, availableLangs) { - function requestBundles(requestedLangs = new Set(navigator.languages)) { + let langs = navigator.languages; + + for (let i=0; i < langs.length; i++) { + if (langs[i].indexOf('-') > 0 && availableLangs.has(langs[i]) === false) { + langs[i] = langs[i].substring(0, langs[i].indexOf('-')); + } + } + + function requestBundles(requestedLangs = new Set(langs)) { const newLangs = prioritizeLocales( defaultLang, availableLangs, requestedLangs );