You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
649 B
TypeScript
34 lines
649 B
TypeScript
|
4 years ago
|
import { useCache } from '@/hooks/web/useCache'
|
||
|
|
import zhCn from 'element-plus/lib/locale/lang/zh-cn'
|
||
|
|
import en from 'element-plus/lib/locale/lang/en'
|
||
|
|
|
||
|
|
const { wsCache } = useCache()
|
||
|
|
|
||
|
|
export const elLocaleMap = {
|
||
|
|
'zh-CN': zhCn,
|
||
|
|
en: en
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface LocaleState {
|
||
|
|
locale: LocaleDropdownType
|
||
|
|
localeMap: LocaleDropdownType[]
|
||
|
|
}
|
||
|
|
|
||
|
|
export const localeModules: LocaleState = {
|
||
|
|
locale: {
|
||
|
|
lang: wsCache.get('lang') || 'zh-CN',
|
||
|
|
elLocale: elLocaleMap[wsCache.get('lang') || 'zh-CN']
|
||
|
|
},
|
||
|
|
// 多语言
|
||
|
|
localeMap: [
|
||
|
|
{
|
||
|
|
lang: 'zh-CN',
|
||
|
|
name: '简体中文'
|
||
|
|
},
|
||
|
|
{
|
||
|
|
lang: 'en',
|
||
|
|
name: 'English'
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|