mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-24 18:26:17 +03:00
chore: use await changing locale on initial load
This commit is contained in:
parent
8fe904d0b5
commit
71923d30dd
1 changed files with 2 additions and 5 deletions
|
@ -11,11 +11,8 @@ export default defineNuxtPlugin(async (nuxt) => {
|
||||||
if (!supportLanguages.includes(lang))
|
if (!supportLanguages.includes(lang))
|
||||||
userSettings.value.language = getDefaultLanguage(supportLanguages)
|
userSettings.value.language = getDefaultLanguage(supportLanguages)
|
||||||
|
|
||||||
if (lang !== i18n.locale) {
|
if (lang !== i18n.locale)
|
||||||
setLocale(userSettings.value.language)
|
await setLocale(userSettings.value.language)
|
||||||
// without this line, the locale not being refreshed on F5 and so the watch will change the locale twice
|
|
||||||
i18n.locale = userSettings.value.language
|
|
||||||
}
|
|
||||||
|
|
||||||
watch([$$(lang), isHydrated], () => {
|
watch([$$(lang), isHydrated], () => {
|
||||||
if (isHydrated.value && lang !== i18n.locale)
|
if (isHydrated.value && lang !== i18n.locale)
|
||||||
|
|
Loading…
Reference in a new issue