From 7a71ae5f37689f7e895e74400f7484109ffaded3 Mon Sep 17 00:00:00 2001 From: Nils Maier Date: Mon, 2 Sep 2019 00:21:32 +0200 Subject: [PATCH] Also split ui locales by _ --- lib/i18n.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/i18n.ts b/lib/i18n.ts index 560f8f4..1b075cc 100644 --- a/lib/i18n.ts +++ b/lib/i18n.ts @@ -123,9 +123,13 @@ async function loadRawLocales() { const langs = new Set(["en"]); const ui = (browser.i18n || chrome.i18n).getUILanguage(); langs.add(ui); + + // Try the base too 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));