feat: bump to latest vue 3.4.19 (#2607)
Co-authored-by: patak <matias.capeletto@gmail.com>
This commit is contained in:
parent
81ef8ff9aa
commit
36004a7eba
40 changed files with 601 additions and 451 deletions
|
@ -1,5 +1,5 @@
|
|||
import FloatingVue from 'floating-vue'
|
||||
import { defineNuxtPlugin } from '#app'
|
||||
import { defineNuxtPlugin } from '#imports'
|
||||
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
nuxtApp.vueApp.use(FloatingVue)
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
import type { VueI18n } from 'vue-i18n'
|
||||
import type { LocaleObject } from 'vue-i18n-routing'
|
||||
|
||||
export default defineNuxtPlugin(async (nuxt) => {
|
||||
const i18n = nuxt.vueApp.config.globalProperties.$i18n as VueI18n
|
||||
const { setLocale, locales } = i18n
|
||||
const userSettings = useUserSettings()
|
||||
const lang = computed(() => userSettings.value.language)
|
||||
|
||||
const supportLanguages = (locales as LocaleObject[]).map(locale => locale.code)
|
||||
if (!supportLanguages.includes(lang.value))
|
||||
userSettings.value.language = getDefaultLanguage(supportLanguages)
|
||||
|
||||
if (lang.value !== i18n.locale)
|
||||
await setLocale(userSettings.value.language)
|
||||
|
||||
watch([lang, isHydrated], () => {
|
||||
if (isHydrated.value && lang.value !== i18n.locale)
|
||||
setLocale(lang.value)
|
||||
}, { immediate: true })
|
||||
})
|
28
plugins/setup-i18n.ts
Normal file
28
plugins/setup-i18n.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
export default defineNuxtPlugin(async (nuxt) => {
|
||||
const t = nuxt.vueApp.config.globalProperties.$t
|
||||
const d = nuxt.vueApp.config.globalProperties.$d
|
||||
const n = nuxt.vueApp.config.globalProperties.$n
|
||||
|
||||
nuxt.vueApp.config.globalProperties.$t = wrapI18n(t)
|
||||
nuxt.vueApp.config.globalProperties.$d = wrapI18n(d)
|
||||
nuxt.vueApp.config.globalProperties.$n = wrapI18n(n)
|
||||
|
||||
if (process.client) {
|
||||
const i18n = nuxt.vueApp.config.globalProperties.$i18n as import('vue-i18n').VueI18n
|
||||
const { setLocale, locales } = i18n
|
||||
const userSettings = useUserSettings()
|
||||
const lang = computed(() => userSettings.value.language)
|
||||
|
||||
const supportLanguages = (locales as import('vue-i18n-routing').LocaleObject[]).map(locale => locale.code)
|
||||
if (!supportLanguages.includes(lang.value))
|
||||
userSettings.value.language = getDefaultLanguage(supportLanguages)
|
||||
|
||||
if (lang.value !== i18n.locale)
|
||||
await setLocale(userSettings.value.language)
|
||||
|
||||
watch([lang, isHydrated], () => {
|
||||
if (isHydrated.value && lang.value !== i18n.locale)
|
||||
setLocale(lang.value)
|
||||
}, { immediate: true })
|
||||
}
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue