Add language options to appearance settings

This commit is contained in:
2023-06-06 23:37:07 +02:00
parent 89c1f18f0e
commit f12c59800a
2 changed files with 18 additions and 0 deletions

View File

@ -2,6 +2,11 @@ import { createI18n } from "vue-i18n";
import { strings } from "@/strings";
import { ref, watch } from "vue";
export const localeNames = {
de: "German",
en: "English",
};
export const language = ref(localStorage.getItem("lang") || "en");
let i18n = createI18n({

View File

@ -1,6 +1,7 @@
<script setup>
import { theme } from "@/store";
import RadioButtons from "@/components/settings/radio-buttons.vue";
import i18n, { language, localeNames } from "@/i18n";
</script>
<template>
@ -15,6 +16,14 @@ import RadioButtons from "@/components/settings/radio-buttons.vue";
:values="['auto', 'light', 'dark']"
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>
<style scoped>
@ -25,4 +34,8 @@ h2 {
p {
margin: 5px 0px;
}
.spacer {
height: 20px;
}
</style>