0
0
Fork 0
mirror of https://github.com/VueTubeApp/VueTube synced 2024-11-01 17:32:39 +00:00
VueTube/NUXT/components/Settings/language.vue
deepsource-autofix[bot] f784c45c91
Format code with prettier
2022-06-22 05:29:34 +00:00

48 lines
999 B
Vue

<template>
<v-select
v-model="selectedLang"
background-color="background"
:items="langs"
label="App Language"
solo
></v-select>
</template>
<script>
export default {
data() {
return {
langs: [],
lang: { mods: { general: { language: "" } } },
selectedLang: null,
};
},
watch: {
//--- Update Stored Language Value ---//
selectedLang: function (newVal) {
const langs = this.$lang(null, true);
let lang = String();
for (const i in langs) {
if (langs[i].name == newVal) {
lang = i;
console.log(lang);
}
}
localStorage.setItem("language", lang);
},
//--- End Update Stored Language Value ---//
},
mounted() {
const lang = this.$lang();
this.lang = lang.mods.general;
const langs = this.$lang(null, true);
for (const i in langs) {
this.langs.push(langs[i].name);
}
this.selectedLang = this.$lang().name;
},
};
</script>