32 lines
569 B
TypeScript
32 lines
569 B
TypeScript
|
|
import { createI18n } from 'vue-i18n'
|
||
|
|
// 中文 zh-cn
|
||
|
|
// 英文 en
|
||
|
|
|
||
|
|
// element-plus 中的语言配置
|
||
|
|
import elementEnLocale from './en'
|
||
|
|
|
||
|
|
// 自己的语言配置
|
||
|
|
import enLocale from './en'
|
||
|
|
|
||
|
|
// 语言配置整合
|
||
|
|
const messages = {
|
||
|
|
'ENGLISH':{
|
||
|
|
...enLocale,
|
||
|
|
...elementEnLocale
|
||
|
|
},
|
||
|
|
// 'CHINESE_SIMPLIFIED':{
|
||
|
|
// ...zhLocale,
|
||
|
|
// ...elementZhLocale
|
||
|
|
// },
|
||
|
|
}
|
||
|
|
|
||
|
|
// 创建 i18n
|
||
|
|
const i18n = createI18n({
|
||
|
|
legacy: false,
|
||
|
|
globalInjection:true, // 全局模式,可以直接使用 $t
|
||
|
|
locale: 'ENGLISH',
|
||
|
|
messages: messages
|
||
|
|
})
|
||
|
|
|
||
|
|
export default i18n
|