新增国际化

This commit is contained in:
liuziting
2026-01-21 17:20:16 +08:00
parent 7559efa93a
commit f642ba1916
7 changed files with 287 additions and 76 deletions

15
src/i18n/index.ts Normal file
View File

@@ -0,0 +1,15 @@
import { createI18n } from 'vue-i18n'
import en from './locales/en.json'
import zh from './locales/zh.json'
const i18n = createI18n({
legacy: false, // 使用 Composition API
locale: localStorage.getItem('language') || 'zh', // 默认中文
fallbackLocale: 'en',
messages: {
en,
zh
}
})
export default i18n