Update the locale when version or language changed (#3263)
This commit is contained in:
parent
81312f5a93
commit
fa66b79e2d
|
@ -69,11 +69,14 @@
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
let locale = localStorage.getItem('locale');
|
let locale = localStorage.getItem('locale');
|
||||||
if (locale == null) {
|
const localeKey = localStorage.getItem('localeKey');
|
||||||
|
|
||||||
|
if (locale == null || localeKey != `${ver}.${lang}`) {
|
||||||
const locale = await fetch(`/assets/locales/${lang}.json?ver=${ver}`)
|
const locale = await fetch(`/assets/locales/${lang}.json?ver=${ver}`)
|
||||||
.then(response => response.json());
|
.then(response => response.json());
|
||||||
|
|
||||||
localStorage.setItem('locale', JSON.stringify(locale));
|
localStorage.setItem('locale', JSON.stringify(locale));
|
||||||
|
localStorage.setItem('localeKey', `${ver}.${lang}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detect the user agent
|
// Detect the user agent
|
||||||
|
|
Loading…
Reference in New Issue