feat(i18n): 重构国际化组件,添加新的语言支持和功能
This commit is contained in:
1
auto-imports.d.ts
vendored
1
auto-imports.d.ts
vendored
@ -192,6 +192,7 @@ declare global {
|
||||
const useGeolocation: typeof import('@vueuse/core')['useGeolocation']
|
||||
const useHead: typeof import('@unhead/vue')['useHead']
|
||||
const useHeadSafe: typeof import('@unhead/vue')['useHeadSafe']
|
||||
const useI18n: typeof import('vue-i18n')['useI18n']
|
||||
const useId: typeof import('vue')['useId']
|
||||
const useIdle: typeof import('@vueuse/core')['useIdle']
|
||||
const useImage: typeof import('@vueuse/core')['useImage']
|
||||
|
@ -30,6 +30,7 @@
|
||||
},
|
||||
"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",
|
||||
@ -51,6 +52,7 @@
|
||||
"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"
|
||||
},
|
||||
|
261
pnpm-lock.yaml
generated
261
pnpm-lock.yaml
generated
@ -14,6 +14,9 @@ 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))
|
||||
@ -77,6 +80,9 @@ 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))
|
||||
@ -969,6 +975,69 @@ 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'}
|
||||
@ -1305,6 +1374,10 @@ 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}
|
||||
@ -1318,10 +1391,23 @@ 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}
|
||||
@ -1337,6 +1423,10 @@ 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}
|
||||
@ -2435,6 +2525,10 @@ 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'}
|
||||
@ -2663,6 +2757,11 @@ 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
|
||||
@ -3021,6 +3120,10 @@ 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'}
|
||||
@ -3381,6 +3484,10 @@ 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==}
|
||||
|
||||
@ -4254,6 +4361,10 @@ 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'}
|
||||
@ -4889,6 +5000,12 @@ 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:
|
||||
@ -5034,6 +5151,10 @@ 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'}
|
||||
@ -5687,6 +5808,76 @@ 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
|
||||
@ -6021,6 +6212,11 @@ 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
|
||||
@ -6038,8 +6234,25 @@ 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
|
||||
@ -6066,6 +6279,11 @@ 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
|
||||
@ -7591,6 +7809,10 @@ snapshots:
|
||||
|
||||
diff@4.0.2: {}
|
||||
|
||||
dir-glob@3.0.1:
|
||||
dependencies:
|
||||
path-type: 4.0.0
|
||||
|
||||
dotenv@16.4.5: {}
|
||||
|
||||
duplexer@0.1.2: {}
|
||||
@ -7831,6 +8053,14 @@ 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)
|
||||
@ -8256,6 +8486,15 @@ 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
|
||||
@ -8607,6 +8846,13 @@ 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
|
||||
@ -9464,6 +9710,8 @@ snapshots:
|
||||
|
||||
sisteransi@1.0.5: {}
|
||||
|
||||
slash@3.0.0: {}
|
||||
|
||||
slash@5.1.0: {}
|
||||
|
||||
slice-ansi@5.0.0:
|
||||
@ -10273,6 +10521,13 @@ 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
|
||||
@ -10399,6 +10654,12 @@ 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: {}
|
||||
|
@ -1,9 +0,0 @@
|
||||
<template>
|
||||
<select>
|
||||
TODO: i18n
|
||||
</select>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<style scoped></style>
|
64
src/components/i18nComp/index.vue
Normal file
64
src/components/i18nComp/index.vue
Normal file
@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<pre>
|
||||
<i18n lang="json">
|
||||
{
|
||||
"en": {
|
||||
"unplugin-hello": "Hello, unplugin-vue-i18n!"
|
||||
},
|
||||
"ja": {
|
||||
"unplugin-hello": "こんにちは、unplugin-vue-i18n!"
|
||||
}
|
||||
}
|
||||
</i18n></pre
|
||||
>
|
||||
<br />
|
||||
<button @click="showMessage">show messages</button>
|
||||
<div><span class="label">$i18n.availableLocales</span>: {{ $i18n.availableLocales }}</div>
|
||||
<p><span class="label">$t('message.hello')</span>: {{ $t('message.hello') }}</p>
|
||||
<p><span class="label">t('message.hello'): Component1 locale messages: </span>: {{ t('message.hello') }}</p>
|
||||
<p>
|
||||
<span class="label">t('message.greeting'): Fallback global locale messages: </span>: {{ t('message.greeting') }}
|
||||
</p>
|
||||
<p><span class="label">$t('unplugin-hello')</span>: {{ $t('unplugin-hello') }}</p>
|
||||
|
||||
<select v-model="$i18n.locale">
|
||||
<option v-for="lang in $i18n.availableLocales" :key="lang" :value="lang">{{ lang }}</option>
|
||||
</select>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
const messages = {
|
||||
en: { message: { hello: 'hello component1' } },
|
||||
ja: { message: { hello: 'こんにちは、component1' } },
|
||||
};
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
const { t } = useI18n({ messages });
|
||||
function showMessage() {
|
||||
alert(JSON.stringify(messages, null, 2));
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.label {
|
||||
color: #2c3e50;
|
||||
font-weight: bold;
|
||||
background-color: #f8f9fa;
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-family: monospace;
|
||||
}
|
||||
</style>
|
||||
|
||||
https://vue-i18n.intlify.dev/guide/advanced/sfc.html#unplugin-vue-i18n
|
||||
<i18n lang="json">
|
||||
{
|
||||
"en": {
|
||||
"unplugin-hello": "Hello, unplugin-vue-i18n!"
|
||||
},
|
||||
"ja": {
|
||||
"unplugin-hello": "こんにちは、unplugin-vue-i18n!"
|
||||
}
|
||||
}
|
||||
</i18n>
|
25
src/main.ts
25
src/main.ts
@ -8,6 +8,7 @@ import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
|
||||
import { DataLoaderPlugin } from 'unplugin-vue-router/data-loaders';
|
||||
import App from './App.vue';
|
||||
import { router } from './router';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
|
||||
async function init() {
|
||||
if (import.meta.env.MODE === 'development' || 1 === 1) {
|
||||
@ -29,7 +30,29 @@ async function init() {
|
||||
// Register the plugin before the router
|
||||
.use(DataLoaderPlugin, { router })
|
||||
// adding the router will trigger the initial navigation
|
||||
.use(router);
|
||||
.use(router)
|
||||
.use(
|
||||
// https://vue-i18n.intlify.dev/guide/essentials/started.html#registering-the-i18n-plugin
|
||||
createI18n({
|
||||
legacy: false, // you must set `false`, to use Composition API
|
||||
locale: navigator.language,
|
||||
fallbackLocale: 'en',
|
||||
messages: {
|
||||
en: {
|
||||
message: {
|
||||
hello: 'hello world',
|
||||
greeting: 'good morning, world!',
|
||||
},
|
||||
},
|
||||
ja: {
|
||||
message: {
|
||||
hello: 'こんにちは、世界',
|
||||
greeting: 'おはよう、世界!',
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
app.config.globalProperties.$__DEV__ = $__DEV__;
|
||||
app.mount('#app');
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
<script lang="tsx" setup>
|
||||
import I18nComp from '../components/i18nComp.vue';
|
||||
import { routes } from 'vue-router/auto-routes';
|
||||
import I18nComp from '../components/i18nComp/index.vue';
|
||||
|
||||
useHead({
|
||||
// Titles
|
||||
@ -64,6 +65,9 @@ const FComponent: import('vue').FunctionalComponent<{ prop: string }> = (props,
|
||||
<div b="1px solid pink" mt-8 p-8>
|
||||
<SendSms />
|
||||
</div>
|
||||
<div b="1px solid pink" mt-8 p-8>
|
||||
<pre>{{ JSON.stringify(routes, null, 2) }}</pre>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style module>
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { createProgressGuard, createLogGuard, createStackGuard } from 'utils4u/vue-router';
|
||||
import { createRouter, createWebHistory, type Router } from 'vue-router';
|
||||
import { routes, handleHotUpdate } from 'vue-router/auto-routes';
|
||||
console.debug(`routes :>> `, JSON.stringify(routes, null, 2));
|
||||
|
||||
export const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
|
@ -1,8 +1,10 @@
|
||||
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
|
||||
import { unheadVueComposablesImports } from '@unhead/vue';
|
||||
import { VantResolver } from '@vant/auto-import-resolver';
|
||||
import Vue from '@vitejs/plugin-vue';
|
||||
import VueJsx from '@vitejs/plugin-vue-jsx';
|
||||
import { fileURLToPath, URL } from 'node:url';
|
||||
import { dirname } from 'node:path';
|
||||
import { fileURLToPath, resolve, URL } from 'node:url';
|
||||
import UnoCSS from 'unocss/vite';
|
||||
import { type ImportsMap } from 'unplugin-auto-import/types';
|
||||
import AutoImport from 'unplugin-auto-import/vite';
|
||||
@ -90,7 +92,15 @@ function Plugins() {
|
||||
plugins.push(
|
||||
AutoImport({
|
||||
resolvers: [TDesignResolver({ library: 'mobile-vue', esm: true }), VantResolver({ importStyle: true })],
|
||||
imports: ['vue', 'pinia', '@vueuse/core', VueRouterAutoImports, unheadVueComposablesImports, Utils4uAutoImports],
|
||||
imports: [
|
||||
'vue',
|
||||
'pinia',
|
||||
'@vueuse/core',
|
||||
VueRouterAutoImports,
|
||||
unheadVueComposablesImports,
|
||||
Utils4uAutoImports,
|
||||
'vue-i18n',
|
||||
],
|
||||
}),
|
||||
Components({
|
||||
// allow auto load markdown components under `./src/components/`
|
||||
@ -131,6 +141,14 @@ function Plugins() {
|
||||
]),
|
||||
);
|
||||
|
||||
plugins.push(
|
||||
VueI18nPlugin({
|
||||
/* options */
|
||||
// locale messages resource pre-compile option
|
||||
include: resolve(dirname(fileURLToPath(import.meta.url)), './path/to/src/locales/**'),
|
||||
}),
|
||||
);
|
||||
|
||||
plugins.push(
|
||||
// https://github.com/condorheroblog/vite-plugin-fake-server?tab=readme-ov-file#usage
|
||||
vitePluginFakeServer({
|
||||
|
Reference in New Issue
Block a user