فهرست منبع

:globe_with_meridians: 目录

visuddhinanda 2 سال پیش
والد
کامیت
462f1c24e6

+ 7 - 1
dashboard/src/components/article/AnthologyDetail.tsx

@@ -11,6 +11,7 @@ import StudioName from "../auth/Studio";
 import TimeShow from "../general/TimeShow";
 import Marked from "../general/Marked";
 import AnthologyTocTree from "../anthology/AnthologyTocTree";
+import { useIntl } from "react-intl";
 
 const { Title, Text, Paragraph } = Typography;
 
@@ -36,6 +37,7 @@ const AnthologyDetailWidget = ({
   onError,
 }: IWidgetAnthologyDetail) => {
   const [tableData, setTableData] = useState<IAnthologyData>();
+  const intl = useIntl();
 
   useEffect(() => {
     fetchData(aid);
@@ -100,7 +102,11 @@ const AnthologyDetailWidget = ({
       <Paragraph>
         <Marked text={tableData?.summary} />
       </Paragraph>
-      <Title level={5}>目录</Title>
+      <Title level={5}>
+        {intl.formatMessage({
+          id: "labels.table-of-content",
+        })}
+      </Title>
       <AnthologyTocTree
         anthologyId={aid}
         channels={channels}

+ 5 - 1
dashboard/src/components/article/ArticleCardMainMenu.tsx

@@ -4,12 +4,14 @@ import { MenuOutlined, PushpinOutlined } from "@ant-design/icons";
 import PaliTextToc from "./PaliTextToc";
 import Find from "./Find";
 import Nav from "./Nav";
+import { useIntl } from "react-intl";
 
 interface IWidget {
   type?: string;
   articleId?: string;
 }
 const ArticleCardMainMenuWidget = ({ type, articleId }: IWidget) => {
+  const intl = useIntl();
   const id = articleId?.split("_");
   let tocWidget = <></>;
   if (id && id.length > 0) {
@@ -34,7 +36,9 @@ const ArticleCardMainMenuWidget = ({ type, articleId }: IWidget) => {
       }}
       items={[
         {
-          label: `目录`,
+          label: intl.formatMessage({
+            id: "labels.table-of-content",
+          }),
           key: "1",
           children: <div style={styleTabBody}>{tocWidget}</div>,
         },

+ 9 - 1
dashboard/src/components/article/ToolButtonToc.tsx

@@ -6,6 +6,7 @@ import { ArticleType } from "./Article";
 import PaliTextToc from "./PaliTextToc";
 import ToolButton from "./ToolButton";
 import TextBookToc from "../anthology/TextBookToc";
+import { useIntl } from "react-intl";
 
 interface IWidget {
   type?: ArticleType;
@@ -23,6 +24,7 @@ const ToolButtonTocWidget = ({
   channels,
   onSelect,
 }: IWidget) => {
+  const intl = useIntl();
   //TODO 都放return里面
   let tocWidget = <></>;
   if (type === "chapter" || type === "para") {
@@ -72,7 +74,13 @@ const ToolButtonTocWidget = ({
   }
 
   return (
-    <ToolButton title="目录" icon={<MenuOutlined />} content={tocWidget} />
+    <ToolButton
+      title={intl.formatMessage({
+        id: "labels.table-of-content",
+      })}
+      icon={<MenuOutlined />}
+      content={tocWidget}
+    />
   );
 };
 

+ 1 - 0
dashboard/src/locales/en-US/label.ts

@@ -38,6 +38,7 @@ const items = {
   "labels.curr.paragraph.cart.tpl": "Add to Cart",
   "labels.software.edition.basic": "basic",
   "labels.software.edition.pro": "pro",
+  "labels.table-of-content": "table of content",
 };
 
 export default items;

+ 1 - 0
dashboard/src/locales/zh-Hans/label.ts

@@ -43,6 +43,7 @@ const items = {
   "labels.dict.pass.4": "查二次衍生",
   "labels.software.edition.basic": "基本版",
   "labels.software.edition.pro": "增强版",
+  "labels.table-of-content": "目录",
 };
 
 export default items;

+ 8 - 1
dashboard/src/pages/library/article/show.tsx

@@ -53,6 +53,7 @@ import ChannelAlert from "../../../components/channel/ChannelAlert";
 import PrPull from "../../../components/corpus/PrPull";
 import NotificationIcon from "../../../components/notification/NotificationIcon";
 import SentCart from "../../../components/template/SentEdit/SentCart";
+import { useIntl } from "react-intl";
 
 export const scrollToTop = () => {
   document.getElementById("article-root")?.scrollIntoView();
@@ -84,6 +85,7 @@ const Widget = () => {
   const [recentModalOpen, setRecentModalOpen] = useState(false);
   const [loadedArticleData, setLoadedArticleData] =
     useState<IArticleDataResponse>();
+  const intl = useIntl();
 
   const paraChange = useAppSelector(paraParam);
 
@@ -220,7 +222,12 @@ const Widget = () => {
                   setSearchParams(output);
                 }}
               />
-              <Tooltip title="文章目录" placement="bottomLeft">
+              <Tooltip
+                title={intl.formatMessage({
+                  id: "labels.table-of-content",
+                })}
+                placement="bottomLeft"
+              >
                 <Button
                   style={{ display: "block", color: "white" }}
                   icon={<UnorderedListOutlined />}

+ 3 - 1
dashboard/src/pages/studio/anthology/edit.tsx

@@ -61,7 +61,9 @@ const Widget = () => {
             },
             {
               key: "toc",
-              label: `目录`,
+              label: intl.formatMessage({
+                id: "labels.table-of-content",
+              }),
               children: (
                 <EditableTocTree
                   studioName={anthologyInfo?.studio.realName}