some fixes for firefox

This commit is contained in:
Florian Dold 2017-04-24 16:45:40 +02:00
parent 290677b98a
commit b60f5cf77b
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B

View File

@ -32,11 +32,18 @@ const i18nResult = [] as any;
let lang: string;
try {
lang = chrome.i18n.getUILanguage();
// Chrome gives e.g. "en-US", but Firefox gives us "en_US"
lang = lang.replace("_", "-");
} catch (e) {
lang = "en";
console.warn("i18n default language not available");
}
if (!strings[lang]) {
lang = "en-US";
console.log(`language ${lang} not found, defaulting to english`);
}
let jed = new jedLib.Jed(strings[lang]);