X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fstore.js;h=a1e432f342d9313a6464a9f5a8c089ebc5076859;hp=798251f9dc87962c9d3cd9ae77a1fae654638403;hb=d641bec1b3b299e16b7da93f966dad0b0bd35088;hpb=a3ac374ba213c7044db6cbcfafb81d4b66a0a290 diff --git a/client/src/store.js b/client/src/store.js index 798251f9..a1e432f3 100644 --- a/client/src/store.js +++ b/client/src/store.js @@ -38,6 +38,13 @@ export const store = this.state.user.email = res.email; this.state.user.notify = res.notify; }); + const supportedLangs = ["en","es","fr"]; + this.state.lang = localStorage["lang"] || + (supportedLangs.includes(navigator.language) + ? navigator.language + : "en"); + this.setTranslations(); + // Initialize connection (even if the current page doesn't need it) this.state.conn = new WebSocket(params.socketUrl + "/?sid=" + mysid + "&page=" + encodeURIComponent(page)); // Settings initialized with values from localStorage @@ -53,12 +60,6 @@ export const store = "&page=" + encodeURIComponent(page)); }; this.state.conn.onclose = this.socketCloseListener; - const supportedLangs = ["en","es","fr"]; - this.state.lang = localStorage["lang"] || - (supportedLangs.includes(navigator.language) - ? navigator.language - : "en"); - this.setTranslations(); }, updateSetting: function(propName, value) { this.state.settings[propName] = value;