From e1023bb3313282b00d6dcdefd5d7e30d7aaa1bfc Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期四, 30 十一月 2023 11:13:29 +0800
Subject: [PATCH] update 优化 代码中存在的警告

---
 src/lang/index.ts |   32 +++++++++++---------------------
 1 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/src/lang/index.ts b/src/lang/index.ts
index 8fdf19e..dddb86b 100644
--- a/src/lang/index.ts
+++ b/src/lang/index.ts
@@ -2,38 +2,28 @@
 import { createI18n } from 'vue-i18n';
 
 // 鏈湴璇█鍖�
-import enLocale from './en';
-import zhCnLocale from './zh-cn';
-import Cookies from 'js-cookie';
+import enUSLocale from './en_US';
+import zhCNLocale from './zh_CN';
 
 const messages = {
-  'zh-cn': {
-    ...zhCnLocale
+  zh_CN: {
+    ...zhCNLocale
   },
-  en: {
-    ...enLocale
+  en_US: {
+    ...enUSLocale
   }
 };
 
 /**
- * 鑾峰彇褰撳墠绯荤粺浣跨敤璇█瀛楃涓�
+ * 鑾峰彇褰撳墠璇█
  * @returns zh-cn|en ...
  */
 export const getLanguage = () => {
-  // 鏈湴缂撳瓨鑾峰彇
-  let language = Cookies.get('language');
-  if (language) {
-    return language;
+  const language = useStorage('language', 'zh_CN');
+  if (language.value) {
+    return language.value;
   }
-  // 娴忚鍣ㄤ娇鐢ㄨ瑷�
-  language = navigator.language.toLowerCase();
-  const locales = Object.keys(messages);
-  for (const locale of locales) {
-    if (language.indexOf(locale) > -1) {
-      return locale;
-    }
-  }
-  return 'zh-cn';
+  return 'zh_CN';
 };
 
 const i18n = createI18n({

--
Gitblit v1.9.3