2018-12-02 18:38:43 -06:00
|
|
|
<template>
|
|
|
|
<ui-card>
|
2019-02-17 20:13:56 -06:00
|
|
|
<template #title><fa icon="language"/> {{ $t('title') }}</template>
|
2018-12-02 18:38:43 -06:00
|
|
|
|
|
|
|
<section class="fit-top">
|
|
|
|
<ui-select v-model="lang" :placeholder="$t('pick-language')">
|
|
|
|
<optgroup :label="$t('recommended')">
|
|
|
|
<option value="">{{ $t('auto') }}</option>
|
|
|
|
</optgroup>
|
|
|
|
|
|
|
|
<optgroup :label="$t('specify-language')">
|
|
|
|
<option v-for="x in langs" :value="x[0]" :key="x[0]">{{ x[1] }}</option>
|
|
|
|
</optgroup>
|
|
|
|
</ui-select>
|
|
|
|
<ui-info>Current: <i>{{ currentLanguage }}</i></ui-info>
|
|
|
|
<ui-info warn>{{ $t('info') }}</ui-info>
|
|
|
|
</section>
|
|
|
|
</ui-card>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2019-02-28 19:42:28 -06:00
|
|
|
import i18n from '../../../../i18n';
|
|
|
|
import { langs } from '../../../../config';
|
2018-12-02 18:38:43 -06:00
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
i18n: i18n('common/views/components/language-settings.vue'),
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
langs,
|
|
|
|
currentLanguage: 'Unknown',
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
lang: {
|
|
|
|
get() { return this.$store.state.device.lang; },
|
|
|
|
set(value) { this.$store.commit('device/set', { key: 'lang', value }); }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
created() {
|
|
|
|
try {
|
|
|
|
const locale = JSON.parse(localStorage.getItem('locale') || "{}");
|
|
|
|
const localeKey = localStorage.getItem('localeKey');
|
|
|
|
this.currentLanguage = `${locale.meta.lang} (${localeKey})`;
|
|
|
|
} catch { }
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|