Преглед изворни кода

使用term 显示relation本地字符串

visuddhinanda пре 3 година
родитељ
комит
e9a2395ac9
1 измењених фајлова са 7 додато и 3 уклоњено
  1. 7 3
      dashboard/src/pages/admin/relation/list.tsx

+ 7 - 3
dashboard/src/pages/admin/relation/list.tsx

@@ -17,6 +17,8 @@ import { useRef } from "react";
 import { IUser } from "../../../reducers/current-user";
 import RelationEdit from "../../../components/admin/relation/RelationEdit";
 import DataImport from "../../../components/admin/relation/DataImport";
+import { useAppSelector } from "../../../hooks";
+import { getTerm } from "../../../reducers/term-vocabulary";
 
 const { Text } = Typography;
 
@@ -97,6 +99,7 @@ export interface IRelation {
 }
 const Widget = () => {
   const intl = useIntl(); //i18n
+  const terms = useAppSelector(getTerm);
 
   const showDeleteConfirm = (id?: string, title?: string) => {
     Modal.confirm({
@@ -177,9 +180,10 @@ const Widget = () => {
             dataIndex: "name1",
             key: "name1",
             render: (text, row, index, action) => {
-              return intl.formatMessage({
-                id: `relations.${row.name}.label`,
-              });
+              const localName = terms?.find(
+                (item) => item.word === row.name
+              )?.meaning;
+              return localName;
             },
           },
           {