From a4cc30f8167f18480dd2c078d94306cf355ca5b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A5=E6=B5=A9?= Date: Thu, 7 Nov 2024 10:38:42 +0800 Subject: [PATCH] =?UTF-8?q?feat(i18n):=20=E7=A7=BB=E9=99=A4=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 - pnpm-lock.yaml | 261 ------------------------------------ src/components/i18nComp.vue | 9 ++ src/main.ts | 23 +--- src/pages/index-page.vue | 26 +--- vite.config.ts | 15 +-- 6 files changed, 16 insertions(+), 320 deletions(-) create mode 100644 src/components/i18nComp.vue diff --git a/package.json b/package.json index 5e9fc45..1b70a0f 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ }, "dependencies": { "@alova/adapter-axios": "^2.0.9", - "@intlify/unplugin-vue-i18n": "^5.2.0", "@unhead/vue": "^1.11.10", "@vant/use": "^1.6.0", "@vueuse/core": "^11.2.0", @@ -52,7 +51,6 @@ "vant": "^4.9.8", "vite-plugin-webfont-dl": "^3.9.5", "vue": "^3.5.12", - "vue-i18n": "10", "vue-page-stack": "^3.2.0", "vue-router": "^4.4.5" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3ed56d0..9754f81 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,9 +14,6 @@ importers: '@alova/adapter-axios': specifier: ^2.0.9 version: 2.0.9(alova@3.1.1)(axios@1.7.7) - '@intlify/unplugin-vue-i18n': - specifier: ^5.2.0 - version: 5.2.0(@vue/compiler-dom@3.5.12)(eslint@9.13.0(jiti@2.3.3))(rollup@4.24.0)(typescript@5.6.3)(vue-i18n@10.0.4(vue@3.5.12(typescript@5.6.3)))(vue@3.5.12(typescript@5.6.3))(webpack-sources@3.2.3) '@unhead/vue': specifier: ^1.11.10 version: 1.11.10(vue@3.5.12(typescript@5.6.3)) @@ -80,9 +77,6 @@ importers: vue: specifier: ^3.5.12 version: 3.5.12(typescript@5.6.3) - vue-i18n: - specifier: '10' - version: 10.0.4(vue@3.5.12(typescript@5.6.3)) vue-page-stack: specifier: ^3.2.0 version: 3.2.0(vue-router@4.4.5(vue@3.5.12(typescript@5.6.3)))(vue@3.5.12(typescript@5.6.3)) @@ -975,69 +969,6 @@ packages: '@iconify/utils@2.1.33': resolution: {integrity: sha512-jP9h6v/g0BIZx0p7XGJJVtkVnydtbgTgt9mVNcGDYwaa7UhdHdI9dvoq+gKj9sijMSJKxUPEG2JyjsgXjxL7Kw==} - '@intlify/bundle-utils@9.0.0-beta.0': - resolution: {integrity: sha512-xVaMrgbr60fYE1Jkq+k6grs2ZoXqh1EU71RVKkHkKh3KP7T6OYtG1Vbp1T09/jCUbv1GBd8Ir5WdZDyN+e8BpQ==} - engines: {node: '>= 18'} - peerDependencies: - petite-vue-i18n: '*' - vue-i18n: '*' - peerDependenciesMeta: - petite-vue-i18n: - optional: true - vue-i18n: - optional: true - - '@intlify/core-base@10.0.4': - resolution: {integrity: sha512-GG428DkrrWCMhxRMRQZjuS7zmSUzarYcaHJqG9VB8dXAxw4iQDoKVQ7ChJRB6ZtsCsX3Jse1PEUlHrJiyQrOTg==} - engines: {node: '>= 16'} - - '@intlify/message-compiler@10.0.0': - resolution: {integrity: sha512-OcaWc63NC/9p1cMdgoNKBj4d61BH8sUW1Hfs6YijTd9656ZR4rNqXAlRnBrfS5ABq0vjQjpa8VnyvH9hK49yBw==} - engines: {node: '>= 16'} - - '@intlify/message-compiler@10.0.4': - resolution: {integrity: sha512-AFbhEo10DP095/45EauinQJ5hJ3rJUmuuqltGguvc3WsvezZN+g8qNHLGWKu60FHQVizMrQY7VJ+zVlBXlQQkQ==} - engines: {node: '>= 16'} - - '@intlify/shared@10.0.0': - resolution: {integrity: sha512-6ngLfI7DOTew2dcF9WMJx+NnMWghMBhIiHbGg+wRvngpzD5KZJZiJVuzMsUQE1a5YebEmtpTEfUrDp/NqVGdiw==} - engines: {node: '>= 16'} - - '@intlify/shared@10.0.4': - resolution: {integrity: sha512-ukFn0I01HsSgr3VYhYcvkTCLS7rGa0gw4A4AMpcy/A9xx/zRJy7PS2BElMXLwUazVFMAr5zuiTk3MQeoeGXaJg==} - engines: {node: '>= 16'} - - '@intlify/unplugin-vue-i18n@5.2.0': - resolution: {integrity: sha512-pmRiPY2Nj9mmSrixT69aO45XxGUr5fDBy/IIw4ajLlDTJm5TSmQKA5YNdsH0uxVDCPWy5tlQrF18hkDwI7UJvg==} - engines: {node: '>= 18'} - peerDependencies: - petite-vue-i18n: '*' - vue: ^3.2.25 - vue-i18n: '*' - peerDependenciesMeta: - petite-vue-i18n: - optional: true - vue-i18n: - optional: true - - '@intlify/vue-i18n-extensions@7.0.0': - resolution: {integrity: sha512-MtvfJnb4aklpCU5Q/dkWkBT/vGsp3qERiPIwtTq5lX4PCLHtUprAJZp8wQj5ZcwDaFCU7+yVMjYbeXpIf927cA==} - engines: {node: '>= 18'} - peerDependencies: - '@intlify/shared': ^9.0.0 || ^10.0.0 - '@vue/compiler-dom': ^3.0.0 - vue: ^3.0.0 - vue-i18n: ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - '@intlify/shared': - optional: true - '@vue/compiler-dom': - optional: true - vue: - optional: true - vue-i18n: - optional: true - '@isaacs/cliui@8.0.2': resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} engines: {node: '>=12'} @@ -1374,10 +1305,6 @@ packages: typescript: optional: true - '@typescript-eslint/scope-manager@7.18.0': - resolution: {integrity: sha512-jjhdIE/FPF2B7Z1uzc6i3oWKbGcHb87Qw7AWj6jmEqNOfDFbJWtjt/XfwCpvNkpGWlcJaog5vTR+VV8+w9JflA==} - engines: {node: ^18.18.0 || >=20.0.0} - '@typescript-eslint/scope-manager@8.8.1': resolution: {integrity: sha512-X4JdU+66Mazev/J0gfXlcC/dV6JI37h+93W9BRYXrSn0hrE64IoWgVkO9MSJgEzoWkxONgaQpICWg8vAN74wlA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1391,23 +1318,10 @@ packages: typescript: optional: true - '@typescript-eslint/types@7.18.0': - resolution: {integrity: sha512-iZqi+Ds1y4EDYUtlOOC+aUmxnE9xS/yCigkjA7XpTKV6nCBd3Hp/PRGGmdwnfkV2ThMyYldP1wRpm/id99spTQ==} - engines: {node: ^18.18.0 || >=20.0.0} - '@typescript-eslint/types@8.8.1': resolution: {integrity: sha512-WCcTP4SDXzMd23N27u66zTKMuEevH4uzU8C9jf0RO4E04yVHgQgW+r+TeVTNnO1KIfrL8ebgVVYYMMO3+jC55Q==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/typescript-estree@7.18.0': - resolution: {integrity: sha512-aP1v/BSPnnyhMHts8cf1qQ6Q1IFwwRvAQGRvBFkWlo3/lH29OXA3Pts+c10nxRxIBrDnoMqzhgdwVe5f2D6OzA==} - engines: {node: ^18.18.0 || >=20.0.0} - peerDependencies: - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - '@typescript-eslint/typescript-estree@8.8.1': resolution: {integrity: sha512-A5d1R9p+X+1js4JogdNilDuuq+EHZdsH9MjTVxXOdVFfTJXunKJR/v+fNNyO4TnoOn5HqobzfRlc70NC6HTcdg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1423,10 +1337,6 @@ packages: peerDependencies: eslint: ^8.57.0 || ^9.0.0 - '@typescript-eslint/visitor-keys@7.18.0': - resolution: {integrity: sha512-cDF0/Gf81QpY3xYyJKDV14Zwdmid5+uuENhjH2EqFaF0ni+yAyq/LzMaIJdhNJXZI7uLzwIlA+V7oWoyn6Curg==} - engines: {node: ^18.18.0 || >=20.0.0} - '@typescript-eslint/visitor-keys@8.8.1': resolution: {integrity: sha512-0/TdC3aeRAsW7MDvYRwEc1Uwm0TIBfzjPFgg60UU2Haj5qsCs9cc3zNgY71edqE3LbWfF/WoZQd3lJoDXFQpag==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -2525,10 +2435,6 @@ packages: resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} engines: {node: '>=0.3.1'} - dir-glob@3.0.1: - resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} - engines: {node: '>=8'} - dotenv@16.4.5: resolution: {integrity: sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==} engines: {node: '>=12'} @@ -2757,11 +2663,6 @@ packages: resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==} engines: {node: '>=12'} - escodegen@2.1.0: - resolution: {integrity: sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==} - engines: {node: '>=6.0'} - hasBin: true - eslint-config-prettier@9.1.0: resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} hasBin: true @@ -3120,10 +3021,6 @@ packages: resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} engines: {node: '>=18'} - globby@11.1.0: - resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} - engines: {node: '>=10'} - globby@14.0.2: resolution: {integrity: sha512-s3Fq41ZVh7vbbe2PN3nrW7yC7U7MFVc5c98/iTl9c2GawNMKx/J648KQRW6WKkuU8GIbbh2IXfIRQjOZnXcTnw==} engines: {node: '>=18'} @@ -3484,10 +3381,6 @@ packages: engines: {node: '>=6'} hasBin: true - jsonc-eslint-parser@2.4.0: - resolution: {integrity: sha512-WYDyuc/uFcGp6YtM2H0uKmUwieOuzeE/5YocFJLnLfclZ4inf3mRn8ZVy1s7Hxji7Jxm6Ss8gqpexD/GlKoGgg==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - jsonfile@4.0.0: resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==} @@ -4361,10 +4254,6 @@ packages: sisteransi@1.0.5: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} - slash@3.0.0: - resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} - engines: {node: '>=8'} - slash@5.1.0: resolution: {integrity: sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==} engines: {node: '>=14.16'} @@ -5000,12 +4889,6 @@ packages: vue-flow-layout@0.0.5: resolution: {integrity: sha512-lZlqQ/Se1trGMtBMneZDWaiQiQBuxU8ivZ+KpJMem5zKROFpzuPq9KqyWABbSYbxq0qhqZs1I4DBwrY041rtOA==} - vue-i18n@10.0.4: - resolution: {integrity: sha512-1xkzVxqBLk2ZFOmeI+B5r1J7aD/WtNJ4j9k2mcFcQo5BnOmHBmD7z4/oZohh96AAaRZ4Q7mNQvxc9h+aT+Md3w==} - engines: {node: '>= 16'} - peerDependencies: - vue: ^3.0.0 - vue-page-stack@3.2.0: resolution: {integrity: sha512-MSv1usz6BdfyIH1JLd+9RgQPl42lMl3k9VGnXPq90odG31Y8l62gFjZaVSy/URJSc0Ya46TBX4FwrpJ4odon9A==} peerDependencies: @@ -5151,10 +5034,6 @@ packages: yallist@4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} - yaml-eslint-parser@1.2.3: - resolution: {integrity: sha512-4wZWvE398hCP7O8n3nXKu/vdq1HcH01ixYlCREaJL5NUMwQ0g3MaGFUBNSlmBtKmhbtVG/Cm6lyYmSVTEVil8A==} - engines: {node: ^14.17.0 || >=16.0.0} - yaml@1.10.2: resolution: {integrity: sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==} engines: {node: '>= 6'} @@ -5808,76 +5687,6 @@ snapshots: transitivePeerDependencies: - supports-color - '@intlify/bundle-utils@9.0.0-beta.0(vue-i18n@10.0.4(vue@3.5.12(typescript@5.6.3)))': - dependencies: - '@intlify/message-compiler': 10.0.0 - '@intlify/shared': 10.0.0 - acorn: 8.12.1 - escodegen: 2.1.0 - estree-walker: 2.0.2 - jsonc-eslint-parser: 2.4.0 - mlly: 1.7.2 - source-map-js: 1.2.1 - yaml-eslint-parser: 1.2.3 - optionalDependencies: - vue-i18n: 10.0.4(vue@3.5.12(typescript@5.6.3)) - - '@intlify/core-base@10.0.4': - dependencies: - '@intlify/message-compiler': 10.0.4 - '@intlify/shared': 10.0.4 - - '@intlify/message-compiler@10.0.0': - dependencies: - '@intlify/shared': 10.0.0 - source-map-js: 1.2.1 - - '@intlify/message-compiler@10.0.4': - dependencies: - '@intlify/shared': 10.0.4 - source-map-js: 1.2.1 - - '@intlify/shared@10.0.0': {} - - '@intlify/shared@10.0.4': {} - - '@intlify/unplugin-vue-i18n@5.2.0(@vue/compiler-dom@3.5.12)(eslint@9.13.0(jiti@2.3.3))(rollup@4.24.0)(typescript@5.6.3)(vue-i18n@10.0.4(vue@3.5.12(typescript@5.6.3)))(vue@3.5.12(typescript@5.6.3))(webpack-sources@3.2.3)': - dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.13.0(jiti@2.3.3)) - '@intlify/bundle-utils': 9.0.0-beta.0(vue-i18n@10.0.4(vue@3.5.12(typescript@5.6.3))) - '@intlify/shared': 10.0.0 - '@intlify/vue-i18n-extensions': 7.0.0(@intlify/shared@10.0.0)(@vue/compiler-dom@3.5.12)(vue-i18n@10.0.4(vue@3.5.12(typescript@5.6.3)))(vue@3.5.12(typescript@5.6.3)) - '@rollup/pluginutils': 5.1.2(rollup@4.24.0) - '@typescript-eslint/scope-manager': 7.18.0 - '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.6.3) - debug: 4.3.7 - fast-glob: 3.3.2 - js-yaml: 4.1.0 - json5: 2.2.3 - pathe: 1.1.2 - picocolors: 1.1.0 - source-map-js: 1.2.1 - unplugin: 1.14.1(webpack-sources@3.2.3) - vue: 3.5.12(typescript@5.6.3) - optionalDependencies: - vue-i18n: 10.0.4(vue@3.5.12(typescript@5.6.3)) - transitivePeerDependencies: - - '@vue/compiler-dom' - - eslint - - rollup - - supports-color - - typescript - - webpack-sources - - '@intlify/vue-i18n-extensions@7.0.0(@intlify/shared@10.0.0)(@vue/compiler-dom@3.5.12)(vue-i18n@10.0.4(vue@3.5.12(typescript@5.6.3)))(vue@3.5.12(typescript@5.6.3))': - dependencies: - '@babel/parser': 7.26.2 - optionalDependencies: - '@intlify/shared': 10.0.0 - '@vue/compiler-dom': 3.5.12 - vue: 3.5.12(typescript@5.6.3) - vue-i18n: 10.0.4(vue@3.5.12(typescript@5.6.3)) - '@isaacs/cliui@8.0.2': dependencies: string-width: 5.1.2 @@ -6212,11 +6021,6 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/scope-manager@7.18.0': - dependencies: - '@typescript-eslint/types': 7.18.0 - '@typescript-eslint/visitor-keys': 7.18.0 - '@typescript-eslint/scope-manager@8.8.1': dependencies: '@typescript-eslint/types': 8.8.1 @@ -6234,25 +6038,8 @@ snapshots: - eslint - supports-color - '@typescript-eslint/types@7.18.0': {} - '@typescript-eslint/types@8.8.1': {} - '@typescript-eslint/typescript-estree@7.18.0(typescript@5.6.3)': - dependencies: - '@typescript-eslint/types': 7.18.0 - '@typescript-eslint/visitor-keys': 7.18.0 - debug: 4.3.7 - globby: 11.1.0 - is-glob: 4.0.3 - minimatch: 9.0.5 - semver: 7.6.3 - ts-api-utils: 1.3.0(typescript@5.6.3) - optionalDependencies: - typescript: 5.6.3 - transitivePeerDependencies: - - supports-color - '@typescript-eslint/typescript-estree@8.8.1(typescript@5.6.3)': dependencies: '@typescript-eslint/types': 8.8.1 @@ -6279,11 +6066,6 @@ snapshots: - supports-color - typescript - '@typescript-eslint/visitor-keys@7.18.0': - dependencies: - '@typescript-eslint/types': 7.18.0 - eslint-visitor-keys: 3.4.3 - '@typescript-eslint/visitor-keys@8.8.1': dependencies: '@typescript-eslint/types': 8.8.1 @@ -7809,10 +7591,6 @@ snapshots: diff@4.0.2: {} - dir-glob@3.0.1: - dependencies: - path-type: 4.0.0 - dotenv@16.4.5: {} duplexer@0.1.2: {} @@ -8053,14 +7831,6 @@ snapshots: escape-string-regexp@5.0.0: {} - escodegen@2.1.0: - dependencies: - esprima: 4.0.1 - estraverse: 5.3.0 - esutils: 2.0.3 - optionalDependencies: - source-map: 0.6.1 - eslint-config-prettier@9.1.0(eslint@9.13.0(jiti@2.3.3)): dependencies: eslint: 9.13.0(jiti@2.3.3) @@ -8486,15 +8256,6 @@ snapshots: globals@14.0.0: {} - globby@11.1.0: - dependencies: - array-union: 2.1.0 - dir-glob: 3.0.1 - fast-glob: 3.3.2 - ignore: 5.3.2 - merge2: 1.4.1 - slash: 3.0.0 - globby@14.0.2: dependencies: '@sindresorhus/merge-streams': 2.3.0 @@ -8846,13 +8607,6 @@ snapshots: json5@2.2.3: {} - jsonc-eslint-parser@2.4.0: - dependencies: - acorn: 8.12.1 - eslint-visitor-keys: 3.4.3 - espree: 9.6.1 - semver: 7.6.3 - jsonfile@4.0.0: optionalDependencies: graceful-fs: 4.2.11 @@ -9710,8 +9464,6 @@ snapshots: sisteransi@1.0.5: {} - slash@3.0.0: {} - slash@5.1.0: {} slice-ansi@5.0.0: @@ -10521,13 +10273,6 @@ snapshots: transitivePeerDependencies: - typescript - vue-i18n@10.0.4(vue@3.5.12(typescript@5.6.3)): - dependencies: - '@intlify/core-base': 10.0.4 - '@intlify/shared': 10.0.4 - '@vue/devtools-api': 6.6.4 - vue: 3.5.12(typescript@5.6.3) - vue-page-stack@3.2.0(vue-router@4.4.5(vue@3.5.12(typescript@5.6.3)))(vue@3.5.12(typescript@5.6.3)): dependencies: '@vue/shared': 3.5.11 @@ -10654,12 +10399,6 @@ snapshots: yallist@4.0.0: {} - yaml-eslint-parser@1.2.3: - dependencies: - eslint-visitor-keys: 3.4.3 - lodash: 4.17.21 - yaml: 2.5.1 - yaml@1.10.2: {} yaml@2.5.1: {} diff --git a/src/components/i18nComp.vue b/src/components/i18nComp.vue new file mode 100644 index 0000000..a76a8ec --- /dev/null +++ b/src/components/i18nComp.vue @@ -0,0 +1,9 @@ + + + + + diff --git a/src/main.ts b/src/main.ts index e8dd708..3bbd311 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,23 +4,10 @@ import 'virtual:uno.css'; import { createHead } from '@unhead/vue'; import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'; -import { createI18n } from 'vue-i18n'; import { DataLoaderPlugin } from 'unplugin-vue-router/data-loaders'; import App from './App.vue'; import { router } from './router'; -// 自动导入语言文件 -interface LocaleMessages { - [key: string]: string; -} - -const messages = Object.fromEntries( - Object.entries(import.meta.glob>('./locales/*.json', { eager: true })).map( - ([key, value]) => { - return [key.slice('./locales/'.length, -5), value.default]; - }, - ), -); async function init() { if (import.meta.env.MODE === 'development' || 1 === 1) { @@ -42,15 +29,7 @@ async function init() { // Register the plugin before the router .use(DataLoaderPlugin, { router }) // adding the router will trigger the initial navigation - .use(router) - .use( - createI18n({ - legacy: false, // 使用 Composition API 模式 - locale: 'zh', // 默认语言 - fallbackLocale: 'en', // 回退语言 - messages, - }), - ); + .use(router); app.config.globalProperties.$__DEV__ = $__DEV__; app.mount('#app'); } diff --git a/src/pages/index-page.vue b/src/pages/index-page.vue index 21b8b77..15f6f6d 100644 --- a/src/pages/index-page.vue +++ b/src/pages/index-page.vue @@ -1,4 +1,6 @@