From 20f64b54d55603a63bbae959dbf3112de8a96c5f Mon Sep 17 00:00:00 2001 From: LiuHao <liuhaoai545@gmail> Date: 星期三, 19 四月 2023 11:05:30 +0800 Subject: [PATCH] fix 修改国际化文件名称不规范问题,增加reqeust 国际化配置 --- src/lang/index.ts | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/lang/index.ts b/src/lang/index.ts index 8ed51e9..f8c0801 100644 --- a/src/lang/index.ts +++ b/src/lang/index.ts @@ -2,26 +2,26 @@ import { createI18n } from 'vue-i18n'; // 鏈湴璇█鍖� -import enLocale from './en'; -import zhCnLocale from './zh-cn'; +import enUSLocale from './en_US'; +import zhCNLocale from './zh_CN'; +import Cookies from 'js-cookie'; const messages = { - 'zh-cn': { - ...zhCnLocale + zh_CN: { + ...zhCNLocale }, - en: { - ...enLocale + en_US: { + ...enUSLocale } }; /** * 鑾峰彇褰撳墠绯荤粺浣跨敤璇█瀛楃涓� - * * @returns zh-cn|en ... */ export const getLanguage = () => { // 鏈湴缂撳瓨鑾峰彇 - let language = localStorage.getItem('language'); + let language = Cookies.get('language'); if (language) { return language; } @@ -33,13 +33,13 @@ return locale; } } - return 'zh-cn'; + return 'zh_CN'; }; const i18n = createI18n({ legacy: false, locale: getLanguage(), - messages: messages + messages }); export default i18n; -- Gitblit v1.9.3