-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(lang): changing how translation string are fetched (#415)
- Loading branch information
Showing
12 changed files
with
133 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<script lang="ts" setup> | ||
import { NeCombobox, type NeComboboxOption, savePreference } from '@nethesis/vue-components' | ||
import { useI18n } from 'vue-i18n' | ||
import { computed, watch } from 'vue' | ||
import { isStandaloneMode } from '@/lib/config' | ||
import { useLoginStore as useStandaloneLoginStore } from '@/stores/standalone/standaloneLogin' | ||
import { useLoginStore as useControllerLoginStore } from '@/stores/controller/controllerLogin' | ||
const { t, locale, availableLocales } = useI18n({ useScope: 'global' }) | ||
const loginStore = isStandaloneMode() ? useStandaloneLoginStore() : useControllerLoginStore() | ||
const supportedLanguages = computed((): NeComboboxOption[] => { | ||
return availableLocales.map((locale) => { | ||
return { | ||
id: locale, | ||
label: t(`languages.${locale}`) | ||
} | ||
}) | ||
}) | ||
watch(locale, () => { | ||
savePreference('locale', locale.value, loginStore.username) | ||
}) | ||
</script> | ||
|
||
<template> | ||
<NeCombobox | ||
v-model="locale" | ||
:limitedOptionsLabel="t('ne_combobox.limited_options_label')" | ||
:noOptionsLabel="t('ne_combobox.dpi.no_options_label')" | ||
:noResultsLabel="t('ne_combobox.no_results')" | ||
:optionalLabel="t('common.optional')" | ||
:options="supportedLanguages" | ||
:selected-label="t('ne_combobox.selected')" | ||
:user-input-label="t('ne_combobox.user_input_label')" | ||
/> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.