From: Benjamin Auder Date: Sat, 29 Feb 2020 02:51:41 +0000 (+0100) Subject: Fix language detection X-Git-Url: https://git.auder.net/game/current/%7B%7B%20asset%28%27mixstore/images/banner.png%27%29%20%7D%7D?a=commitdiff_plain;h=dfa6eb760d51263b051f72d0fe968458d369f187;p=vchess.git Fix language detection --- diff --git a/client/src/store.js b/client/src/store.js index e7e86971..52870e0a 100644 --- a/client/src/store.js +++ b/client/src/store.js @@ -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) {