feat: global option change language
This commit is contained in:
parent
d3c03ef233
commit
52172b7133
5 changed files with 700 additions and 57 deletions
|
|
@ -44,6 +44,7 @@ const { visible } = storeToRefs(loaderStore);
|
|||
const { locale } = useI18n({ useScope: 'global' });
|
||||
const userStore = useUserStore();
|
||||
|
||||
const rawOption = ref();
|
||||
const canvasModal = ref(false);
|
||||
const leftDrawerOpen = ref(false);
|
||||
const filterUnread = ref(false);
|
||||
|
|
@ -127,6 +128,12 @@ watch(
|
|||
() => currentLanguage.value,
|
||||
() => {
|
||||
localStorage.setItem('currentLanguage', currentLanguage.value);
|
||||
if (rawOption.value) {
|
||||
if (locale.value === 'en-US')
|
||||
optionStore.globalOption = rawOption.value.eng;
|
||||
if (locale.value === 'th-th')
|
||||
optionStore.globalOption = rawOption.value.tha;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -143,7 +150,9 @@ onMounted(async () => {
|
|||
}
|
||||
|
||||
const resultOption = await fetch('/option/option.json');
|
||||
optionStore.globalOption = await resultOption.json();
|
||||
rawOption.value = await resultOption.json();
|
||||
if (locale.value === 'en-US') optionStore.globalOption = rawOption.value.eng;
|
||||
if (locale.value === 'th-th') optionStore.globalOption = rawOption.value.tha;
|
||||
|
||||
const user = getUsername();
|
||||
const uid = getUserId();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue