Show current selected language (#3429)

This commit is contained in:
MeiMei 2018-11-29 21:56:53 +09:00 committed by syuilo
parent 91f624c900
commit 55a57db958
2 changed files with 19 additions and 1 deletions

View file

@ -182,6 +182,7 @@
</optgroup> </optgroup>
</ui-select> </ui-select>
<div class="none ui info"> <div class="none ui info">
<div>Current: <i>{{ this.currentLanguage }}</i></div>
<p><fa icon="info-circle"/>{{ $t('language-desc') }}</p> <p><fa icon="info-circle"/>{{ $t('language-desc') }}</p>
</div> </div>
</section> </section>
@ -350,6 +351,7 @@ export default Vue.extend({
meta: null, meta: null,
version, version,
langs, langs,
currentLanguage: 'Unknown',
latestVersion: undefined, latestVersion: undefined,
checkingForUpdate: false checkingForUpdate: false
}; };
@ -554,6 +556,12 @@ export default Vue.extend({
this.$root.getMeta().then(meta => { this.$root.getMeta().then(meta => {
this.meta = meta; this.meta = meta;
}); });
try {
const locale = JSON.parse(localStorage.getItem('locale') || "{}");
const localeKey = localStorage.getItem('localeKey');
this.currentLanguage = `${locale.meta.lang} (${localeKey})`;
} catch { }
}, },
methods: { methods: {
readAllUnreadNotes() { readAllUnreadNotes() {

View file

@ -118,7 +118,8 @@
<option v-for="x in langs" :value="x[0]" :key="x[0]">{{ x[1] }}</option> <option v-for="x in langs" :value="x[0]" :key="x[0]">{{ x[1] }}</option>
</optgroup> </optgroup>
</ui-select> </ui-select>
<span><fa icon="info-circle"/> {{ $t('lang-tip') }}</span> <div>Current: <i>{{ this.currentLanguage }}</i></div>
<p><fa icon="info-circle"/> {{ $t('lang-tip') }}</p>
</section> </section>
</ui-card> </ui-card>
@ -225,6 +226,7 @@ export default Vue.extend({
version, version,
codename, codename,
langs, langs,
currentLanguage: 'Unknown',
latestVersion: undefined, latestVersion: undefined,
checkingForUpdate: false checkingForUpdate: false
}; };
@ -377,6 +379,14 @@ export default Vue.extend({
}, },
}, },
created() {
try {
const locale = JSON.parse(localStorage.getItem('locale') || "{}");
const localeKey = localStorage.getItem('localeKey');
this.currentLanguage = `${locale.meta.lang} (${localeKey})`;
} catch { }
},
mounted() { mounted() {
document.title = this.$t('settings'); document.title = this.$t('settings');
}, },