From b717b6252c79acd4f5bc83fe7411c13d9ea5553e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A5=E6=B5=A9?= Date: Wed, 6 Nov 2024 18:45:37 +0800 Subject: [PATCH] =?UTF-8?q?feat(i18n):=20=E6=9B=B4=E6=96=B0=E8=AF=AD?= =?UTF-8?q?=E8=A8=80=E6=96=87=E4=BB=B6=E5=AF=BC=E5=85=A5=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=BC=BA=E7=B1=BB=E5=9E=8B=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main.ts b/src/main.ts index 6e08fb6..e8dd708 100644 --- a/src/main.ts +++ b/src/main.ts @@ -10,10 +10,16 @@ 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]; - }), + Object.entries(import.meta.glob>('./locales/*.json', { eager: true })).map( + ([key, value]) => { + return [key.slice('./locales/'.length, -5), value.default]; + }, + ), ); async function init() {