From de48ffa10c0e1fad1e086fd99d9290a9ac403fdb Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Wed, 8 Nov 2023 16:47:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BB=8E=E5=AE=A2=E6=88=B7=E7=AB=AF?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=A6=96=E9=80=89=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/index.ts | 2 +- src/plugins/http-fetch.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/i18n/index.ts b/src/i18n/index.ts index aa344943..3e76e545 100644 --- a/src/i18n/index.ts +++ b/src/i18n/index.ts @@ -6,7 +6,7 @@ import enUS from './locales/en-US'; const i18n = createI18n({ legacy: false, // 使用 Composition API 的方式创建 i18n 实例 - locale: localGet(CACHE_LOCAL_I18N) || 'zh_CN', // 默认显示语言 + locale: localGet(CACHE_LOCAL_I18N) || 'en-US', // 默认显示语言 messages: { zh_CN: zhCN, en_US: enUS, diff --git a/src/plugins/http-fetch.ts b/src/plugins/http-fetch.ts index 9a66419c..1eee7479 100644 --- a/src/plugins/http-fetch.ts +++ b/src/plugins/http-fetch.ts @@ -4,8 +4,12 @@ import { sessionGetJSON, sessionSetJSON, } from '@/utils/cache-session-utils'; +import { localGet } from '@/utils/cache-local-utils'; import { TOKEN_KEY, TOKEN_KEY_PREFIX } from '@/constants/token-constants'; -import { CACHE_SESSION_FATCH } from '@/constants/cache-keys-constants'; +import { + CACHE_LOCAL_I18N, + CACHE_SESSION_FATCH, +} from '@/constants/cache-keys-constants'; import { APP_REQUEST_HEADER_CODE, APP_REQUEST_HEADER_VERSION, @@ -92,6 +96,7 @@ const FATCH_OPTIONS: OptionsType = { headers: { [APP_REQUEST_HEADER_CODE]: import.meta.env.VITE_APP_CODE, [APP_REQUEST_HEADER_VERSION]: import.meta.env.VITE_APP_VERSION, + 'Accept-Language': `${localGet(CACHE_LOCAL_I18N)};q=0.9`, }, dataType: 'json', responseType: 'json',