feat: add LocaleSwitcher component
This commit is contained in:
parent
eefc4cc8d4
commit
9757a3d076
1 changed files with 29 additions and 0 deletions
29
src/components/LocaleSwitcher.vue
Normal file
29
src/components/LocaleSwitcher.vue
Normal file
|
@ -0,0 +1,29 @@
|
|||
<script setup lang="ts">
|
||||
const localeFlags = {
|
||||
en: "🇬🇧 English",
|
||||
de: "🇩🇪 Deutsch",
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="localeswitch">
|
||||
<select v-model="$i18n.locale">
|
||||
<option
|
||||
v-for="locale in $i18n.availableLocales"
|
||||
:key="`locale-${locale}`"
|
||||
:value="locale"
|
||||
>
|
||||
{{ localeFlags[locale] }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.localeswitch {
|
||||
select {
|
||||
display: block;
|
||||
margin: auto;
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Add table
Add a link
Reference in a new issue