diff --git a/app/plugins/i18n.ts b/app/plugins/i18n.ts index 84ec238..08fd8eb 100644 --- a/app/plugins/i18n.ts +++ b/app/plugins/i18n.ts @@ -1,9 +1,8 @@ +import type { Locale as TypeLocale } from '#i18n' import { Locale } from 'vant' import enUS from 'vant/es/locale/lang/en-US' import zhCN from 'vant/es/locale/lang/zh-CN' -type AppLocale = 'zh-CN' | 'en-US' - export default defineNuxtPlugin(() => { // 载入 vant 语言包 Locale.use('zh-CN', zhCN) @@ -16,7 +15,7 @@ export default defineNuxtPlugin(() => { const lang = localStorage.getItem('lang') if (lang) { - setLocale(lang as AppLocale) + setLocale(lang as TypeLocale) Locale.use(lang) } else { diff --git a/package.json b/package.json index 6c8d977..fcfaa31 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,9 @@ "inflight": "1", "npmlog": "5", "rimraf": "3" + }, + "patchedDependencies": { + "@nuxtjs/i18n@9.1.0": "patches/@nuxtjs__i18n@9.1.0.patch" } }, "simple-git-hooks": { diff --git a/patches/@nuxtjs__i18n@9.1.0.patch b/patches/@nuxtjs__i18n@9.1.0.patch new file mode 100644 index 0000000..28ab080 --- /dev/null +++ b/patches/@nuxtjs__i18n@9.1.0.patch @@ -0,0 +1,13 @@ +diff --git a/dist/module.mjs b/dist/module.mjs +index b6def32f8bde5516e6ee0a25f153b01803f55683..897b44120533fdb74b33d9d4dff1d21b910073ca 100644 +--- a/dist/module.mjs ++++ b/dist/module.mjs +@@ -1462,7 +1462,7 @@ async function extendBundler({ options: nuxtOptions }, nuxt) { + fullInstall: nuxtOptions.bundle.fullInstall, + onlyLocales: nuxtOptions.bundle.onlyLocales, + dropMessageCompiler: nuxtOptions.bundle.dropMessageCompiler, +- optimizeTranslationDirective: true, ++ optimizeTranslationDirective: false, + strictMessage: nuxtOptions.compilation.strictMessage, + escapeHtml: nuxtOptions.compilation.escapeHtml, + defaultSFCLang: nuxtOptions.customBlocks.defaultSFCLang, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f3927a5..d64f97d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,11 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +patchedDependencies: + '@nuxtjs/i18n@9.1.0': + hash: f7ooybjhk3gbrcmx6vkut3a44i + path: patches/@nuxtjs__i18n@9.1.0.patch + importers: .: @@ -13,7 +18,7 @@ importers: version: 3.5.2(magicast@0.3.5)(rollup@4.27.2)(webpack-sources@3.2.3) '@nuxtjs/i18n': specifier: ^9.1.0 - version: 9.1.0(@vue/compiler-dom@3.5.13)(eslint@9.15.0(jiti@2.4.0))(magicast@0.3.5)(rollup@4.27.2)(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3))(webpack-sources@3.2.3) + version: 9.1.0(patch_hash=f7ooybjhk3gbrcmx6vkut3a44i)(@vue/compiler-dom@3.5.13)(eslint@9.15.0(jiti@2.4.0))(magicast@0.3.5)(rollup@4.27.2)(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3))(webpack-sources@3.2.3) nuxt: specifier: ^3.14.1592 version: 3.14.1592(@parcel/watcher@2.4.1)(@types/node@20.11.30)(encoding@0.1.13)(eslint@9.15.0(jiti@2.4.0))(ioredis@5.4.1)(magicast@0.3.5)(optionator@0.9.3)(rollup@4.27.2)(terser@5.29.2)(typescript@5.6.3)(vite@5.4.11(@types/node@20.11.30)(terser@5.29.2))(vue-tsc@2.1.10(typescript@5.6.3))(webpack-sources@3.2.3) @@ -7066,7 +7071,7 @@ snapshots: - supports-color - webpack-sources - '@nuxtjs/i18n@9.1.0(@vue/compiler-dom@3.5.13)(eslint@9.15.0(jiti@2.4.0))(magicast@0.3.5)(rollup@4.27.2)(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3))(webpack-sources@3.2.3)': + '@nuxtjs/i18n@9.1.0(patch_hash=f7ooybjhk3gbrcmx6vkut3a44i)(@vue/compiler-dom@3.5.13)(eslint@9.15.0(jiti@2.4.0))(magicast@0.3.5)(rollup@4.27.2)(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3))(webpack-sources@3.2.3)': dependencies: '@intlify/h3': 0.6.1 '@intlify/shared': 10.0.4