generated from Seekra/repository-template
refactor(i18n): move locale updater to language switch button
This commit is contained in:
@@ -54,8 +54,6 @@ updateColorScheme(colorScheme.value);
|
|||||||
|
|
||||||
watchEffect(() => updatePageTitle(route));
|
watchEffect(() => updatePageTitle(route));
|
||||||
|
|
||||||
watch(() => getSetting(LANGUAGE_PATH), setLocale);
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
setLocale(getSetting(LANGUAGE_PATH));
|
setLocale(getSetting(LANGUAGE_PATH));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ import Icon from '@/features/icons/components/Icon.vue';
|
|||||||
|
|
||||||
import { LANGUAGE_PATH } from '@/config/featureSettings';
|
import { LANGUAGE_PATH } from '@/config/featureSettings';
|
||||||
import { useSettings } from '@/features/settings/composables/useSettings';
|
import { useSettings } from '@/features/settings/composables/useSettings';
|
||||||
import { ref } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { SUPPORTED_LANGUAGES } from '@/i18n';
|
import { setLocale, SUPPORTED_LANGUAGES } from '@/i18n';
|
||||||
|
|
||||||
const { t, locale } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
const { setSetting } = useSettings();
|
const { setSetting, getSetting } = useSettings();
|
||||||
|
|
||||||
const isOpen = ref(false);
|
const isOpen = ref(false);
|
||||||
const languageDropdown = ref(null);
|
const languageDropdown = ref(null);
|
||||||
@@ -34,6 +34,8 @@ const selectLanguage = function selectLanguage (code) {
|
|||||||
close();
|
close();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
watch(() => getSetting(LANGUAGE_PATH), setLocale);
|
||||||
|
|
||||||
const close = function () {
|
const close = function () {
|
||||||
document.removeEventListener('click', closeWrapperOnClickOutsite);
|
document.removeEventListener('click', closeWrapperOnClickOutsite);
|
||||||
isOpen.value = false;
|
isOpen.value = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user