Procházet zdrojové kódy

发送当前语言

visuddhinanda před 3 roky
rodič
revize
21e89d019f
1 změnil soubory, kde provedl 3 přidání a 1 odebrání
  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 { ProCard } from "@ant-design/pro-components";
 
 
 import { get } from "../../request";
 import { get } from "../../request";
+import { get as getLang } from "../../locales";
 import { IGuideResponse } from "../api/Guide";
 import { IGuideResponse } from "../api/Guide";
 import Marked from "../general/Marked";
 import Marked from "../general/Marked";
 
 
@@ -33,7 +34,8 @@ const Widget = ({ text, gid }: IWidget) => {
     </>
     </>
   );
   );
   function fetchData(key: string) {
   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) => {
     get<IGuideResponse>(url).then((json) => {
       if (json.ok) {
       if (json.ok) {
         sessionStorage.setItem(grammarProfix + key, json.data);
         sessionStorage.setItem(grammarProfix + key, json.data);