feat: 国际化init
This commit is contained in:
6
src/i18n/cn.js
Normal file
6
src/i18n/cn.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import zhLocale from 'element-plus/lib/locale/lang/zh-cn' // 引入element语言包
|
||||
const cn = {
|
||||
...zhLocale
|
||||
}
|
||||
|
||||
export default cn
|
||||
5
src/i18n/en.js
Normal file
5
src/i18n/en.js
Normal file
@@ -0,0 +1,5 @@
|
||||
import enLocale from 'element-plus/lib/locale/lang/en' // 引入element语言包
|
||||
const en = {
|
||||
...enLocale
|
||||
}
|
||||
export default en
|
||||
@@ -1,6 +1,11 @@
|
||||
import { createI18n } from 'vue-i18n'
|
||||
import cn from './cn'
|
||||
import en from './en'
|
||||
const i18n = createI18n({
|
||||
locale: localStorage.getItem('cn-language') || 'en',
|
||||
messages: {}
|
||||
messages: {
|
||||
cn: cn,
|
||||
en: en
|
||||
}
|
||||
})
|
||||
export default i18n
|
||||
|
||||
Reference in New Issue
Block a user