mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-24 16:56:14 -04:00
feat(i18n): language selector (#710)
This commit is contained in:
parent
58de8970f5
commit
e86fd96ae3
12 changed files with 182 additions and 46 deletions
|
@ -116,7 +116,7 @@ function activateOption(option: PaletteOption) {
|
|||
<span flex items-center gap-3 op-40>
|
||||
|
||||
<icon-mdi-search />
|
||||
Search...
|
||||
{{ $t('search.label') }}
|
||||
|
||||
<span hidden flex-1 border border-current border-op-40 rounded border-solid px-5px py-3px sm:inline>
|
||||
{{ isMac ? 'Cmd' : 'Ctrl' }} + K
|
||||
|
|
28
src/modules/i18n/components/locale-selector.vue
Normal file
28
src/modules/i18n/components/locale-selector.vue
Normal file
|
@ -0,0 +1,28 @@
|
|||
<script setup lang="ts">
|
||||
const { availableLocales, locale } = useI18n();
|
||||
|
||||
const localesLong: Record<string, string> = {
|
||||
en: 'English',
|
||||
es: 'Español',
|
||||
fr: 'Français',
|
||||
pt: 'Português',
|
||||
ru: 'Русский',
|
||||
zh: '中文',
|
||||
};
|
||||
|
||||
const localeOptions = computed(() =>
|
||||
availableLocales.map(locale => ({
|
||||
label: localesLong[locale] ?? locale,
|
||||
value: locale,
|
||||
})),
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<c-select
|
||||
v-model:value="locale"
|
||||
:options="localeOptions"
|
||||
placeholder="Select a language"
|
||||
w-100px
|
||||
/>
|
||||
</template>
|
Loading…
Add table
Add a link
Reference in a new issue