From d29bb31311dc08b75df4492368ecdf82dfeff366 Mon Sep 17 00:00:00 2001 From: Xaver Maierhofer Date: Thu, 2 Aug 2018 01:58:41 +0200 Subject: [PATCH] [TASK] Remove localStorage --- lib/utils/language.js | 8 +------- lib/utils/router.js | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/utils/language.js b/lib/utils/language.js index 1435406..b9e88a6 100644 --- a/lib/utils/language.js +++ b/lib/utils/language.js @@ -21,13 +21,8 @@ define(['polyglot', 'moment', 'helper'], function (Polyglot, moment, helper) { router.fullUrl({ lang: event.target.value }, false, true); } - function setLocale(lang) { - localStorage.setItem('language', getLocale(lang)); - location.reload(); - } - function getLocale(input) { - var language = input || localStorage.getItem('language') || navigator.languages && navigator.languages[0] || navigator.language || navigator.userLanguage; + var language = input || navigator.languages && navigator.languages[0] || navigator.language || navigator.userLanguage; var locale = config.supportedLocale[0]; config.supportedLocale.some(function (item) { if (language.indexOf(item) !== -1) { @@ -69,7 +64,6 @@ define(['polyglot', 'moment', 'helper'], function (Polyglot, moment, helper) { return { init: init, getLocale: getLocale, - setLocale: setLocale, languageSelect: languageSelect }; }; diff --git a/lib/utils/router.js b/lib/utils/router.js index 03e00eb..e35bf96 100644 --- a/lib/utils/router.js +++ b/lib/utils/router.js @@ -54,7 +54,7 @@ define(['Navigo'], function (Navigo) { }; if (lang && lang !== state.lang && lang === language.getLocale(lang)) { - language.setLocale(lang); + location.reload(); } if (!init || viewValue && viewValue !== state.view) {