From b60f5cf77b8a9a25aed8976aa132a7db0a3c2e86 Mon Sep 17 00:00:00 2001
From: Florian Dold <florian.dold@gmail.com>
Date: Mon, 24 Apr 2017 16:45:40 +0200
Subject: some fixes for firefox

---
 src/i18n.tsx | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'src/i18n.tsx')

diff --git a/src/i18n.tsx b/src/i18n.tsx
index dcc678900..ff32e62a8 100644
--- a/src/i18n.tsx
+++ b/src/i18n.tsx
@@ -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]);
 
 
-- 
cgit v1.2.3

