feat: 国际化功能基础实现

This commit is contained in:
alger
2025-01-23 11:02:55 +08:00
parent 599b0251af
commit 174428b386
14 changed files with 189 additions and 17 deletions
+26
View File
@@ -0,0 +1,26 @@
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 options = {
legacy: false,
locale: savedLanguage,
fallbackLocale: 'en-US',
messages: {
'zh-CN': zhCN,
'en-US': enUS
},
globalInjection: true,
silentTranslationWarn: true,
silentFallbackWarn: true
} as I18nOptions;
const i18n = createI18n(options);
export default i18n;