feat: 国际化语言默认为英语
This commit is contained in:
@@ -8,13 +8,13 @@ import { localStg } from '@/utils/storage';
|
|||||||
*
|
*
|
||||||
* @param lang
|
* @param lang
|
||||||
*/
|
*/
|
||||||
export function setDayjsLocale(lang: App.I18n.LangType = 'zh-CN') {
|
export function setDayjsLocale(lang: App.I18n.LangType = 'en-US') {
|
||||||
const localMap = {
|
const localMap = {
|
||||||
'zh-CN': 'zh-cn',
|
'zh-CN': 'zh-cn',
|
||||||
'en-US': 'en'
|
'en-US': 'en'
|
||||||
} satisfies Record<App.I18n.LangType, string>;
|
} satisfies Record<App.I18n.LangType, string>;
|
||||||
|
|
||||||
const l = lang || localStg.get('lang') || 'zh-CN';
|
const l = lang || localStg.get('lang') || 'en-US';
|
||||||
|
|
||||||
locale(localMap[l]);
|
locale(localMap[l]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { localStg } from '@/utils/storage';
|
|||||||
import messages from './locale';
|
import messages from './locale';
|
||||||
|
|
||||||
const i18n = createI18n({
|
const i18n = createI18n({
|
||||||
locale: localStg.get('lang') || 'zh-CN',
|
locale: localStg.get('lang') || 'en-US',
|
||||||
fallbackLocale: 'en',
|
fallbackLocale: 'en',
|
||||||
messages,
|
messages,
|
||||||
legacy: false
|
legacy: false
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export const request = createFlatRequest<App.Service.Response, InstanceState>(
|
|||||||
const Authorization = token ? `Bearer ${token}` : null;
|
const Authorization = token ? `Bearer ${token}` : null;
|
||||||
|
|
||||||
// set language
|
// set language
|
||||||
const ContentLanguage = localStg.get('lang') || 'zh-CN';
|
const ContentLanguage = localStg.get('lang') || 'en-US';
|
||||||
Object.assign(headers, { Authorization, "Content-Language": ContentLanguage });
|
Object.assign(headers, { Authorization, "Content-Language": ContentLanguage });
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
|
|||||||
Reference in New Issue
Block a user