From fda317b628bf07314aabfbf70af8e6d83d1829fa Mon Sep 17 00:00:00 2001
From: LiuHao <liuhaoai545@gmail>
Date: 星期三, 19 四月 2023 14:41:15 +0800
Subject: [PATCH] update 修改非时效性数据存入Local中

---
 src/lang/index.ts |   18 ++++--------------
 1 files changed, 4 insertions(+), 14 deletions(-)

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

--
Gitblit v1.9.3