Explorar el Código

发送当前语言

visuddhinanda hace 3 años
padre
commit
21e89d019f
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      dashboard/src/components/dict/GrammarPop.tsx

+ 3 - 1
dashboard/src/components/dict/GrammarPop.tsx

@@ -3,6 +3,7 @@ import { Popover, Typography } from "antd";
 import { ProCard } from "@ant-design/pro-components";
 
 import { get } from "../../request";
+import { get as getLang } from "../../locales";
 import { IGuideResponse } from "../api/Guide";
 import Marked from "../general/Marked";
 
@@ -33,7 +34,8 @@ const Widget = ({ text, gid }: IWidget) => {
     </>
   );
   function fetchData(key: string) {
-    const url = `/v2/guide/zh-cn/${key}`;
+    const uiLang = getLang();
+    const url = `/v2/guide/${uiLang}/${key}`;
     get<IGuideResponse>(url).then((json) => {
       if (json.ok) {
         sessionStorage.setItem(grammarProfix + key, json.data);