Просмотр исходного кода

🌐 (dashboard-v6): 三藏目录右侧抽屉文案走 i18n

资源 / 目录标题、字符 / 段落统计、资源分页「结果」、版本选择弹窗标题改为 react-intl;
目录复用 labels.table-of-content,其余新增 labels.resources、labels.char-count、
labels.paragraph-count、labels.pagination.total、labels.channel.select(en / zh-Hans / zh-Hant)。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
visuddhinanda 8 часов назад
Родитель
Сommit
e115884deb

+ 6 - 2
dashboard-v6/src/components/tipitaka/BookViewer.tsx

@@ -48,11 +48,15 @@ const BookViewerWidget = ({ chapter, onChange }: IWidget) => {
         </Button>
       </Link>
       <div style={{ marginTop: 8 }}>
-        <Typography.Title level={5}>资源</Typography.Title>
+        <Typography.Title level={5}>
+          {intl.formatMessage({ id: "labels.resources" })}
+        </Typography.Title>
         <PaliChapterChannelList para={currChapter} />
       </div>
       <div style={{ marginTop: 16 }}>
-        <Typography.Title level={5}>目录</Typography.Title>
+        <Typography.Title level={5}>
+          {intl.formatMessage({ id: "labels.table-of-content" })}
+        </Typography.Title>
         <PaliChapterListByPara
           compact
           chapter={currChapter}

+ 5 - 2
dashboard-v6/src/components/tipitaka/ChapterInChannel.tsx

@@ -61,7 +61,10 @@ const ChapterInChannelWidget = ({
                 total: channels.length,
                 position: "bottom",
                 showTotal: (total) => {
-                  return `结果: ${total}`;
+                  return intl.formatMessage(
+                    { id: "labels.pagination.total" },
+                    { total }
+                  );
                 },
               }
         }
@@ -137,7 +140,7 @@ const ChapterInChannelWidget = ({
           </Button>
         </div>
         <Modal
-          title="版本选择"
+          title={intl.formatMessage({ id: "labels.channel.select" })}
           open={open}
           onCancel={handleCancel}
           onOk={handleCancel}

+ 4 - 2
dashboard-v6/src/components/tipitaka/PaliChapterCard.tsx

@@ -2,6 +2,7 @@ import { Row, Col, Space } from "antd";
 import { Typography } from "antd";
 import { Tiny } from "@ant-design/plots";
 import TocPath from "./TocPath";
+import { useIntl } from "react-intl";
 
 const { Title, Text, Link } = Typography;
 
@@ -33,14 +34,15 @@ const ChapterStats = ({
   data: IPaliChapterData;
   fontSize?: number;
 }) => {
+  const intl = useIntl();
   // 接口不一定两项都给(v2 view=chapter 没有段落数),缺的那项不显示
   const items = [
     data.chapterStrLen != null && {
-      label: "字符",
+      label: intl.formatMessage({ id: "labels.char-count" }),
       value: formatCount(data.chapterStrLen),
     },
     data.paragraphCount != null && {
-      label: "段落",
+      label: intl.formatMessage({ id: "labels.paragraph-count" }),
       value: data.paragraphCount.toLocaleString("en"),
     },
   ].filter((it): it is { label: string; value: string } => Boolean(it));

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

@@ -142,6 +142,11 @@ const items = {
   "term.fields.meaning2.tooltip": "其他意思将出现在后面的括号里",
   "term.fields.note.label": "note",
   "term.general-in-studio": "general in studio",
+  "labels.resources": "Resources",
+  "labels.char-count": "Chars",
+  "labels.paragraph-count": "Paras",
+  "labels.pagination.total": "Total: {total}",
+  "labels.channel.select": "Select version",
 };
 
 export default items;

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

@@ -149,6 +149,11 @@ const items = {
   "term.fields.meaning2.tooltip": "其他意思将出现在后面的括号里",
   "term.fields.note.label": "注释",
   "term.general-in-studio": "通用于本Studio",
+  "labels.resources": "资源",
+  "labels.char-count": "字符",
+  "labels.paragraph-count": "段落",
+  "labels.pagination.total": "结果: {total}",
+  "labels.channel.select": "版本选择",
 };
 
 export default items;

+ 5 - 0
dashboard-v6/src/locales/zh-Hant/label.ts

@@ -149,6 +149,11 @@ const items = {
   "term.fields.meaning2.tooltip": "其他意思將出現在後面的括號裡",
   "term.fields.note.label": "註釋",
   "term.general-in-studio": "通用於本Studio",
+  "labels.resources": "資源",
+  "labels.char-count": "字元",
+  "labels.paragraph-count": "段落",
+  "labels.pagination.total": "結果: {total}",
+  "labels.channel.select": "版本選擇",
 };
 
 export default items;