[TASK] Remove localStorage

This commit is contained in:
Xaver Maierhofer 2018-08-02 01:58:41 +02:00
parent 2c6303d820
commit d29bb31311
No known key found for this signature in database
GPG Key ID: 7FDCE23FD2EC9FE8
2 changed files with 2 additions and 8 deletions

View File

@ -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
};
};

View File

@ -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) {