[TASK] Remove localStorage
This commit is contained in:
parent
2c6303d820
commit
d29bb31311
@ -21,13 +21,8 @@ define(['polyglot', 'moment', 'helper'], function (Polyglot, moment, helper) {
|
|||||||
router.fullUrl({ lang: event.target.value }, false, true);
|
router.fullUrl({ lang: event.target.value }, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setLocale(lang) {
|
|
||||||
localStorage.setItem('language', getLocale(lang));
|
|
||||||
location.reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
function getLocale(input) {
|
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];
|
var locale = config.supportedLocale[0];
|
||||||
config.supportedLocale.some(function (item) {
|
config.supportedLocale.some(function (item) {
|
||||||
if (language.indexOf(item) !== -1) {
|
if (language.indexOf(item) !== -1) {
|
||||||
@ -69,7 +64,6 @@ define(['polyglot', 'moment', 'helper'], function (Polyglot, moment, helper) {
|
|||||||
return {
|
return {
|
||||||
init: init,
|
init: init,
|
||||||
getLocale: getLocale,
|
getLocale: getLocale,
|
||||||
setLocale: setLocale,
|
|
||||||
languageSelect: languageSelect
|
languageSelect: languageSelect
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -54,7 +54,7 @@ define(['Navigo'], function (Navigo) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (lang && lang !== state.lang && lang === language.getLocale(lang)) {
|
if (lang && lang !== state.lang && lang === language.getLocale(lang)) {
|
||||||
language.setLocale(lang);
|
location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!init || viewValue && viewValue !== state.view) {
|
if (!init || viewValue && viewValue !== state.view) {
|
||||||
|
Loading…
Reference in New Issue
Block a user