feat: 国际化 (i18n) 功能实现

This commit is contained in:
alger
2025-02-19 01:01:43 +08:00
parent da2a32e420
commit ead017e4b1
64 changed files with 1870 additions and 510 deletions
+8 -13
View File
@@ -1,26 +1,21 @@
import type { I18nOptions } from 'vue-i18n';
import { createI18n } from 'vue-i18n';
import enUS from './lang/en-US';
import zhCN from './lang/zh-CN';
// 从配置中获取保存的语言设置
const savedLanguage =
window?.electron?.ipcRenderer?.sendSync('get-store-value', 'set.language') || 'zh-CN';
const messages = {
'zh-CN': zhCN,
'en-US': enUS
};
const options = {
const i18n = createI18n({
legacy: false,
locale: savedLanguage,
locale: 'zh-CN',
fallbackLocale: 'en-US',
messages: {
'zh-CN': zhCN,
'en-US': enUS
},
messages,
globalInjection: true,
silentTranslationWarn: true,
silentFallbackWarn: true
} as I18nOptions;
const i18n = createI18n(options);
});
export default i18n;