mirror of
https://github.com/w0rng/amnezia-wg-easy.git
synced 2025-04-26 13:20:11 +03:00
add environment variable for changes lang
This commit is contained in:
parent
f8c414042a
commit
2c29909ef6
6 changed files with 25 additions and 31 deletions
|
@ -55,8 +55,6 @@ new Vue({
|
|||
currentRelease: null,
|
||||
latestRelease: null,
|
||||
|
||||
langDropdownShow: false,
|
||||
|
||||
chartOptions: {
|
||||
chart: {
|
||||
background: 'transparent',
|
||||
|
@ -255,10 +253,6 @@ new Vue({
|
|||
.catch(err => alert(err.message || err.toString()))
|
||||
.finally(() => this.refresh().catch(console.error));
|
||||
},
|
||||
changeLang(lang) {
|
||||
localStorage.setItem('lang', lang);
|
||||
i18n.locale = lang;
|
||||
},
|
||||
},
|
||||
filters: {
|
||||
bytes,
|
||||
|
@ -285,6 +279,12 @@ new Vue({
|
|||
}, 1000);
|
||||
|
||||
Promise.resolve().then(async () => {
|
||||
const lang = await this.api.getLang();
|
||||
if (lang !== localStorage.getItem('lang') && i18n.availableLocales.includes(lang)) {
|
||||
localStorage.setItem('lang', lang);
|
||||
i18n.locale = lang;
|
||||
}
|
||||
|
||||
const currentRelease = await this.api.getRelease();
|
||||
const latestRelease = await fetch('https://weejewel.github.io/wg-easy/changelog.json')
|
||||
.then(res => res.json())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue