Use composition for translation

This commit is contained in:
2025-08-14 19:56:49 +02:00
parent 900414727f
commit 24f933fbaa
12 changed files with 111 additions and 99 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
<script setup lang="ts">
const { locale, locales } = useI18n();
const { locale, locales, t } = useI18n();
const availableLocales = computed(() => {
return locales.value.filter((i) => i.code !== locale.value);
@@ -15,12 +15,12 @@ function l(locale: (typeof locales.value)[0]) {
v-for="loc in availableLocales"
:key="loc.code"
:to="$switchLocalePath(loc.code)"
:title="$t('layouts.switch_lang', { locale: $t(`locales.${l(loc)}`) })"
:title="t('layouts.switch_lang', { locale: t(`locales.${l(loc)}`) })"
>
<VaSidebarItemContent>
<VaIcon name="language" />
<VaSidebarItemTitle>
{{ $t('layouts.switch_lang', { locale: $t(`locales.${l(loc)}`) }) }}
{{ t('layouts.switch_lang', { locale: t(`locales.${l(loc)}`) }) }}
</VaSidebarItemTitle>
</VaSidebarItemContent>
</VaSidebarItem>