-
Notifications
You must be signed in to change notification settings - Fork 14
/
index.ts
45 lines (39 loc) · 921 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import en from 'element-plus/es/locale/lang/en'
import selfEn from '@/locales/lang/en'
import selfZhHans from '@/locales/lang/zh-hans'
/**
* I18n language locale mappings
*
* 国际化语言映射表设置
*/
export const localesMapping = [
{
localeCode: 'zh-hans',
localeName: '简体中文',
localeLang: {
...zhCn,
...selfZhHans
}
},
{
localeCode: 'en',
localeName: 'English',
localeLang: {
...en,
...selfEn
}
}
] as const
export const currentLocaleMap = (targetLocaleCode) => {
return localesMapping.find(
localeItem => localeItem.localeCode === targetLocaleCode
)
}
export type LangTypes = typeof localesMapping[number]['localeCode']
/**
* Default language locale for the application
*
* 应用程序的默认语言设置
*/
export const defaultLanguageLocale: LangTypes = 'en'