refactor(i18n): 重构国际化模块结构
All checks were successful
CI/CD Pipeline / playwright (push) Successful in 4m14s
CI/CD Pipeline / build-and-deploy (push) Successful in 4m39s

This commit is contained in:
严浩
2025-10-29 13:09:17 +08:00
parent 94d09d0bdd
commit 7dd7ce73bc
10 changed files with 44 additions and 45 deletions

View File

@@ -0,0 +1,17 @@
import type { I18nOptions } from 'vue-i18n';
const modules = import.meta.glob(['./*.ts', '!./route-messages-auto-imports'], {
eager: true,
import: 'default',
});
type MessageType = Record<string, string>;
export const i18nRouteMessages: I18nOptions['messages'] = Object.entries(modules).reduce(
(messages, [path, mod]) => {
const locale = path.replace(/(\.\/|\.ts)/g, '');
messages[locale] = mod as MessageType;
return messages;
},
{} as Record<string, MessageType>,
);