✨ Add language options to appearance settings
This commit is contained in:
@ -2,6 +2,11 @@ import { createI18n } from "vue-i18n";
|
|||||||
import { strings } from "@/strings";
|
import { strings } from "@/strings";
|
||||||
import { ref, watch } from "vue";
|
import { ref, watch } from "vue";
|
||||||
|
|
||||||
|
export const localeNames = {
|
||||||
|
de: "German",
|
||||||
|
en: "English",
|
||||||
|
};
|
||||||
|
|
||||||
export const language = ref(localStorage.getItem("lang") || "en");
|
export const language = ref(localStorage.getItem("lang") || "en");
|
||||||
|
|
||||||
let i18n = createI18n({
|
let i18n = createI18n({
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { theme } from "@/store";
|
import { theme } from "@/store";
|
||||||
import RadioButtons from "@/components/settings/radio-buttons.vue";
|
import RadioButtons from "@/components/settings/radio-buttons.vue";
|
||||||
|
import i18n, { language, localeNames } from "@/i18n";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -15,6 +16,14 @@ import RadioButtons from "@/components/settings/radio-buttons.vue";
|
|||||||
:values="['auto', 'light', 'dark']"
|
:values="['auto', 'light', 'dark']"
|
||||||
v-model="theme"
|
v-model="theme"
|
||||||
/>
|
/>
|
||||||
|
<div class="spacer" />
|
||||||
|
<h2>{{ $t("settings.heading.language") }}</h2>
|
||||||
|
<p>{{ $t("settings.text.language") }}</p>
|
||||||
|
<RadioButtons
|
||||||
|
:options="i18n.global.availableLocales.map((locale) => localeNames[locale])"
|
||||||
|
:values="i18n.global.availableLocales"
|
||||||
|
v-model="language"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@ -25,4 +34,8 @@ h2 {
|
|||||||
p {
|
p {
|
||||||
margin: 5px 0px;
|
margin: 5px 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.spacer {
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Reference in New Issue
Block a user