visuddhinanda 1 день назад
Родитель
Сommit
c0d6a07138
1 измененных файлов с 43 добавлено и 14 удалено
  1. 43 14
      dashboard-v6/src/components/navigation/MainMenu.tsx

+ 43 - 14
dashboard-v6/src/components/navigation/MainMenu.tsx

@@ -23,6 +23,7 @@ import { currentUser } from "../../reducers/current-user";
 import { useRecent } from "../../hooks/useRecent.ts";
 import { useRecent } from "../../hooks/useRecent.ts";
 import RecentModal from "../recent/RecentModal.tsx";
 import RecentModal from "../recent/RecentModal.tsx";
 import SettingModal from "../setting/SettingModal.tsx";
 import SettingModal from "../setting/SettingModal.tsx";
+import { useIntl } from "react-intl";
 
 
 /* ================= 类型 ================= */
 /* ================= 类型 ================= */
 
 
@@ -105,6 +106,8 @@ interface Props {
   onSearch?: () => void;
   onSearch?: () => void;
 }
 }
 const Widget = ({ onSearch }: Props) => {
 const Widget = ({ onSearch }: Props) => {
+  const intl = useIntl(); //i18n
+
   const navigate = useNavigate();
   const navigate = useNavigate();
   const routeId = useCurrentRouteId();
   const routeId = useCurrentRouteId();
   const currUser = useAppSelector(currentUser);
   const currUser = useAppSelector(currentUser);
@@ -145,13 +148,17 @@ const Widget = ({ onSearch }: Props) => {
     {
     {
       key: "/workspace/tipitaka/lib",
       key: "/workspace/tipitaka/lib",
       icon: <TipitakaIcon />,
       icon: <TipitakaIcon />,
-      label: "巴利三藏",
+      label: intl.formatMessage({
+        id: "columns.studio.palicanon.title",
+      }),
       activeId: "workspace.tipitaka",
       activeId: "workspace.tipitaka",
     },
     },
     {
     {
       key: "/workspace/setting",
       key: "/workspace/setting",
       icon: <SettingOutlined />,
       icon: <SettingOutlined />,
-      label: "setting",
+      label: intl.formatMessage({
+        id: "columns.studio.setting.title",
+      }),
       activeId: "workspace.setting",
       activeId: "workspace.setting",
     },
     },
     { type: "divider", key: "d1" },
     { type: "divider", key: "d1" },
@@ -159,7 +166,9 @@ const Widget = ({ onSearch }: Props) => {
     {
     {
       key: "/workspace/recent",
       key: "/workspace/recent",
       icon: <FieldTimeOutlined />,
       icon: <FieldTimeOutlined />,
-      label: "最近打开",
+      label: intl.formatMessage({
+        id: "columns.studio.recent.title",
+      }),
       children: [
       children: [
         ...recentList,
         ...recentList,
         {
         {
@@ -176,13 +185,17 @@ const Widget = ({ onSearch }: Props) => {
       children: [
       children: [
         {
         {
           key: "/workspace/article",
           key: "/workspace/article",
-          label: "文章",
+          label: intl.formatMessage({
+            id: "columns.studio.article.title",
+          }),
           activeId: "workspace.article",
           activeId: "workspace.article",
           icon: <FileOutlined />,
           icon: <FileOutlined />,
         },
         },
         {
         {
           key: "/workspace/anthology",
           key: "/workspace/anthology",
-          label: "文集",
+          label: intl.formatMessage({
+            id: "columns.studio.anthology.title",
+          }),
           activeId: "workspace.anthology",
           activeId: "workspace.anthology",
           icon: <FolderOutlined />,
           icon: <FolderOutlined />,
         },
         },
@@ -192,26 +205,34 @@ const Widget = ({ onSearch }: Props) => {
     {
     {
       key: "/workspace/channel",
       key: "/workspace/channel",
       icon: <ChannelIcon />,
       icon: <ChannelIcon />,
-      label: "版本",
+      label: intl.formatMessage({
+        id: "columns.studio.channel.title",
+      }),
       activeId: "workspace.channel",
       activeId: "workspace.channel",
     },
     },
 
 
     {
     {
       key: "/workspace/term",
       key: "/workspace/term",
       icon: <TermIcon />,
       icon: <TermIcon />,
-      label: "术语",
+      label: intl.formatMessage({
+        id: "columns.studio.term.title",
+      }),
       activeId: "workspace.term",
       activeId: "workspace.term",
     },
     },
 
 
     {
     {
       key: "/workspace/course",
       key: "/workspace/course",
       icon: <CourseOutLinedIcon />,
       icon: <CourseOutLinedIcon />,
-      label: "Course",
+      label: intl.formatMessage({
+        id: "columns.library.course.title",
+      }),
     },
     },
     {
     {
       key: "/workspace/task",
       key: "/workspace/task",
       icon: <TaskIcon />,
       icon: <TaskIcon />,
-      label: "任务",
+      label: intl.formatMessage({
+        id: "labels.task",
+      }),
       activeId: "workspace.task",
       activeId: "workspace.task",
       children: [
       children: [
         {
         {
@@ -221,7 +242,9 @@ const Widget = ({ onSearch }: Props) => {
         },
         },
         {
         {
           key: "/workspace/task/hall",
           key: "/workspace/task/hall",
-          label: "Task hall",
+          label: intl.formatMessage({
+            id: "labels.task.hall",
+          }),
           activeId: "workspace.task.hall",
           activeId: "workspace.task.hall",
         },
         },
         {
         {
@@ -231,12 +254,16 @@ const Widget = ({ onSearch }: Props) => {
         },
         },
         {
         {
           key: "/workspace/task/project",
           key: "/workspace/task/project",
-          label: "projects",
+          label: intl.formatMessage({
+            id: "labels.task.my.project",
+          }),
           activeId: "workspace.task.project",
           activeId: "workspace.task.project",
         },
         },
         {
         {
           key: "/workspace/task/workflows",
           key: "/workspace/task/workflows",
-          label: "workflows",
+          label: intl.formatMessage({
+            id: "labels.task.workflows",
+          }),
           activeId: "workspace.task.workflows",
           activeId: "workspace.task.workflows",
         },
         },
       ],
       ],
@@ -248,7 +275,9 @@ const Widget = ({ onSearch }: Props) => {
       children: [
       children: [
         {
         {
           key: "/workspace/tag",
           key: "/workspace/tag",
-          label: "tag",
+          label: intl.formatMessage({
+            id: "columns.studio.tag.title",
+          }),
           activeId: "workspace.tag",
           activeId: "workspace.tag",
         },
         },
         {
         {
@@ -266,7 +295,7 @@ const Widget = ({ onSearch }: Props) => {
     {
     {
       key: "/workspace/collaboration",
       key: "/workspace/collaboration",
       icon: <CourseOutLinedIcon />,
       icon: <CourseOutLinedIcon />,
-      label: "collaboration",
+      label: intl.formatMessage({ id: "labels.collaboration" }),
       children: [
       children: [
         {
         {
           key: "/workspace/team",
           key: "/workspace/team",