Use vue-i18n #68

Merged
jakob.scheid merged 14 commits from feature/vue-i18n into main 2026-05-20 17:35:02 +02:00
2 changed files with 19 additions and 9 deletions
Showing only changes of commit 16e69ff072 - Show all commits
@@ -16,6 +16,9 @@ limitations under the License.
<script setup>
import { inject } from 'vue';
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const colorScheme = inject('colorScheme');
@@ -25,24 +28,22 @@ const colorSchemeNextMapper = {
'auto': 'light'
};
const colorSchemeTextMapper = {
'light': 'Switch to light mode',
'dark': 'Switch to dark mode',
'auto': 'Switch to the system scheme'
}
const colorSchemeIconMapper = {
'dark': '⏾',
'light': '☀',
'auto': '◐'
}
};
const getTooltipTranslation = function (colorScheme) {
return t(`preferences.colorScheme.switch.${colorSchemeNextMapper[colorScheme]}`);
};
</script>
<template>
<button class="color-scheme-button"
@click="colorScheme = colorSchemeNextMapper[colorScheme]"
:aria-label="colorSchemeTextMapper[colorSchemeNextMapper[colorScheme]]"
:title="colorSchemeTextMapper[colorSchemeNextMapper[colorScheme]]"
:aria-label="getTooltipTranslation(colorScheme)"
:title="getTooltipTranslation(colorScheme)"
>
{{ colorSchemeIconMapper[colorSchemeNextMapper[colorScheme]] }}
</button>
+9
View File
@@ -16,5 +16,14 @@
"back": {
"search": "Back to Search"
}
},
"preferences": {
"colorScheme": {
"switch": {
"light": "Switch to light mode",
"dark": "Switch to dark mode",
"auto": "Switch to the system color scheme"
}
}
}
}