Fix language detection
authorBenjamin Auder <benjamin.auder@somewhere>
Sat, 29 Feb 2020 02:51:41 +0000 (03:51 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Sat, 29 Feb 2020 02:51:41 +0000 (03:51 +0100)
client/src/store.js

index e7e8697..52870e0 100644 (file)
@@ -60,9 +60,10 @@ export const store = {
       highlight: localStorage.getItem("highlight") == "true"
     };
     const supportedLangs = ["en", "es", "fr"];
+    const navLanguage = navigator.language.substr(0,2);
     this.state.lang =
       localStorage["lang"] ||
-      (supportedLangs.includes(navigator.language) ? navigator.language : "en");
+      (supportedLangs.includes(navLanguage) ? navLanguage : "en");
     this.setTranslations();
   },
   updateSetting: function(propName, value) {