diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5edce2d232..d14790f756 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -90,7 +90,7 @@ We've added some `UnoCSS` utilities styles to help you with that: ## Internationalization -We are using [vue-i18n](https://vue-i18n.intlify.dev/) via [nuxt-i18n](https://v8.i18n.nuxtjs.org/) to handle internationalization. +We are using [vue-i18n](https://vue-i18n.intlify.dev/) via [nuxt-i18n](https://i18n.nuxtjs.org/) to handle internationalization. You can check the current [translation status](https://docs.elk.zone/docs/guide/contributing#translation-status): more instructions on the table caption. diff --git a/config/i18n.ts b/config/i18n.ts index c383a72c35..e51da89e51 100644 --- a/config/i18n.ts +++ b/config/i18n.ts @@ -75,11 +75,13 @@ export const countryLocaleVariants: Record ({ - name: "nuxt:components:imports", -+ enforce: "post", - transformInclude(id) { - id = normalize(id); - return id.startsWith("virtual:") || id.startsWith("\0virtual:") || id.startsWith(nuxt.options.buildDir) || !isIgnored(id); diff --git a/patches/vue-i18n.patch b/patches/vue-i18n.patch deleted file mode 100644 index 65bdda43e5..0000000000 --- a/patches/vue-i18n.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/dist/vue-i18n.d.ts b/dist/vue-i18n.d.ts -index 8d5c4fc0e551ab3beccfcaa67764818a2c4c6756..0cee95f214e03add239d3df5e91ad2a8a154ac1e 100644 ---- a/dist/vue-i18n.d.ts -+++ b/dist/vue-i18n.d.ts -@@ -3125,7 +3125,7 @@ export declare type WarnHtmlInMessageLevel = 'off' | 'warn' | 'error'; - - export { } - --declare module '@vue/runtime-core' { -+declare module 'vue' { - /** - * Component Custom Options for Vue I18n - * diff --git a/plugins/setup-i18n.ts b/plugins/setup-i18n.ts index d421f954a4..9c292159e0 100644 --- a/plugins/setup-i18n.ts +++ b/plugins/setup-i18n.ts @@ -1,3 +1,5 @@ +import type { Locale } from '#i18n' + export default defineNuxtPlugin(async (nuxt) => { const t = nuxt.vueApp.config.globalProperties.$t const d = nuxt.vueApp.config.globalProperties.$d @@ -11,14 +13,14 @@ export default defineNuxtPlugin(async (nuxt) => { const i18n = useNuxtApp().$i18n const { setLocale, locales } = i18n const userSettings = useUserSettings() - const lang = computed(() => userSettings.value.language) + const lang = computed(() => userSettings.value.language as Locale) const supportLanguages = unref(locales).map(locale => locale.code) if (!supportLanguages.includes(lang.value)) userSettings.value.language = getDefaultLanguage(supportLanguages) if (lang.value !== i18n.locale) - await setLocale(userSettings.value.language) + await setLocale(userSettings.value.language as Locale) watch([lang, isHydrated], () => { if (isHydrated.value && lang.value !== i18n.locale)