mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat(projects): 1.0 beta
This commit is contained in:
19
src/locales/dayjs.ts
Normal file
19
src/locales/dayjs.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { locale } from 'dayjs';
|
||||
import 'dayjs/locale/zh-cn';
|
||||
import 'dayjs/locale/en';
|
||||
import { localStg } from '@/utils/storage';
|
||||
|
||||
/**
|
||||
* set dayjs locale
|
||||
* @param lang
|
||||
*/
|
||||
export function setDayjsLocale(lang: App.I18n.LangType = 'zh-CN') {
|
||||
const localMap = {
|
||||
'zh-CN': 'zh-cn',
|
||||
'en-US': 'en'
|
||||
} satisfies Record<App.I18n.LangType, string>;
|
||||
|
||||
const l = lang || localStg.get('lang') || 'zh-CN';
|
||||
|
||||
locale(localMap[l]);
|
||||
}
|
Reference in New Issue
Block a user