-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
145 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,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: '简体中文' | ||
localeName: '简体中文', | ||
localeLang: { | ||
...zhCn, | ||
...selfZhHans | ||
} | ||
}, | ||
{ | ||
localeCode: 'en', | ||
localeName: 'English' | ||
localeName: 'English', | ||
localeLang: { | ||
...en, | ||
...selfEn | ||
} | ||
} | ||
] | ||
] as const | ||
|
||
export const isHasLocale = (targetLocaleCode) => { | ||
return localesMapping.find(localeItem => localeItem.localeCode === targetLocaleCode) | ||
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters