2
0

feat: 国际化语言默认为英语

This commit is contained in:
caiyuchao
2025-03-19 11:04:18 +08:00
parent 45fbc12de5
commit 03df615d78
3 changed files with 5 additions and 5 deletions

View File

@@ -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]);
} }

View File

@@ -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

View File

@@ -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;
@@ -148,7 +148,7 @@ export const rawRequest = createRequest(
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;