You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
843 B
37 lines
843 B
2 months ago
|
//语言
|
||
|
import { lang } from '@/settings/designSetting'
|
||
|
import { createI18n } from 'vue-i18n' //引入vue-i18n组件
|
||
|
import { getLocalStorage } from '@/utils'
|
||
|
import { StorageEnum }from '@/enums/storageEnum'
|
||
|
import { LangEnum } from '@/enums/styleEnum'
|
||
|
import { LangStateType } from '@/store/modules/langStore/langStore.d'
|
||
|
import zh from './zh/index'
|
||
|
import en from './en/index'
|
||
|
|
||
|
const langStorage: LangStateType = getLocalStorage(StorageEnum.GO_LANG_STORE)
|
||
|
|
||
|
// 语言数组
|
||
|
export const langList = [
|
||
|
{
|
||
|
label: '中文',
|
||
|
key: LangEnum.ZH
|
||
|
},
|
||
|
{
|
||
|
label: 'English',
|
||
|
key: LangEnum.EN
|
||
|
}
|
||
|
]
|
||
|
|
||
|
const i18n = createI18n({
|
||
|
legacy: false,
|
||
|
globalInjection:true,
|
||
|
locale: langStorage?.lang || lang,
|
||
|
fallbackLocale: langStorage?.lang || lang,
|
||
|
messages: {
|
||
|
[LangEnum.ZH]: zh,
|
||
|
[LangEnum.EN]: en
|
||
|
}
|
||
|
})
|
||
|
|
||
|
export default i18n
|