Also split ui locales by _

This commit is contained in:
Nils Maier 2019-09-02 00:21:32 +02:00
parent d04f3db22f
commit 7a71ae5f37

View File

@ -123,9 +123,13 @@ async function loadRawLocales() {
const langs = new Set<string>(["en"]); const langs = new Set<string>(["en"]);
const ui = (browser.i18n || chrome.i18n).getUILanguage(); const ui = (browser.i18n || chrome.i18n).getUILanguage();
langs.add(ui); langs.add(ui);
// Try the base too
if (ui.includes("-")) { if (ui.includes("-")) {
// Try the base too langs.add(ui.split(/[-]+/)[0]);
langs.add(ui.split(/[_-]+/)[0]); }
else if (ui.includes("_")) {
langs.add(ui.split(/[_]+/)[0]);
} }
const fetched = await Promise.all(Array.from(langs, fetchLanguage)); const fetched = await Promise.all(Array.from(langs, fetchLanguage));