mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-23 22:13:09 +02:00
Update the locale when version or language changed (#3263)
This commit is contained in:
parent
81312f5a93
commit
fa66b79e2d
1 changed files with 4 additions and 1 deletions
|
@ -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 a new issue