Переглянути джерело

fix(dashboard-v6): 主导航菜单 i18n 完善

- driver/dict/team/invite/transfer 复用 v4 的 columns.studio.* 键
- 搜索/主页/文档/工具/待办 等硬编码文案改为 i18n
- 主页新标签提示复用 buttons.open.in.new.tab
visuddhinanda 1 тиждень тому
батько
коміт
f91f57c226

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

@@ -132,18 +132,24 @@ const Widget = ({ onSearch }: Props) => {
     {
     {
       key: "search",
       key: "search",
       icon: <SearchOutlined />,
       icon: <SearchOutlined />,
-      label: "搜索",
+      label: intl.formatMessage({ id: "labels.search" }),
     },
     },
     {
     {
       key: "/workspace",
       key: "/workspace",
       icon: <HomeOutlined />,
       icon: <HomeOutlined />,
-      label: "主页",
+      label: intl.formatMessage({ id: "labels.home" }),
       activeId: "workspace.home",
       activeId: "workspace.home",
       extra: (
       extra: (
         <PlusOutlined
         <PlusOutlined
           role="button"
           role="button"
-          aria-label="open-home-new-tab"
-          title="在新标签页打开主页"
+          aria-label={intl.formatMessage(
+            { id: "buttons.open.in.new.tab" },
+            { item: intl.formatMessage({ id: "labels.home" }) }
+          )}
+          title={intl.formatMessage(
+            { id: "buttons.open.in.new.tab" },
+            { item: intl.formatMessage({ id: "labels.home" }) }
+          )}
           onClick={(e) => {
           onClick={(e) => {
             e.stopPropagation();
             e.stopPropagation();
             window.open(fullUrl("workspace"), "_blank");
             window.open(fullUrl("workspace"), "_blank");
@@ -186,7 +192,7 @@ const Widget = ({ onSearch }: Props) => {
     {
     {
       key: "/workspace/doc",
       key: "/workspace/doc",
       icon: <DocumentIcon />,
       icon: <DocumentIcon />,
-      label: "文档",
+      label: intl.formatMessage({ id: "labels.documents" }),
       children: [
       children: [
         {
         {
           key: "/workspace/article",
           key: "/workspace/article",
@@ -242,7 +248,7 @@ const Widget = ({ onSearch }: Props) => {
       children: [
       children: [
         {
         {
           key: "/workspace/task/pending",
           key: "/workspace/task/pending",
-          label: "Pending",
+          label: intl.formatMessage({ id: "labels.task.pending" }),
           activeId: "workspace.task.pending",
           activeId: "workspace.task.pending",
         },
         },
         {
         {
@@ -254,7 +260,7 @@ const Widget = ({ onSearch }: Props) => {
         },
         },
         {
         {
           key: "/workspace/task/list",
           key: "/workspace/task/list",
-          label: "To-Do List",
+          label: intl.formatMessage({ id: "labels.task.mine" }),
           activeId: "workspace.task.list",
           activeId: "workspace.task.list",
         },
         },
         {
         {
@@ -276,7 +282,7 @@ const Widget = ({ onSearch }: Props) => {
     {
     {
       key: "/workspace/tools",
       key: "/workspace/tools",
       icon: <CourseOutLinedIcon />,
       icon: <CourseOutLinedIcon />,
-      label: "tools",
+      label: intl.formatMessage({ id: "labels.tools" }),
       children: [
       children: [
         {
         {
           key: "/workspace/tag",
           key: "/workspace/tag",
@@ -287,12 +293,16 @@ const Widget = ({ onSearch }: Props) => {
         },
         },
         {
         {
           key: "/workspace/driver",
           key: "/workspace/driver",
-          label: "driver",
+          label: intl.formatMessage({
+            id: "columns.studio.attachment.title",
+          }),
           activeId: "workspace.driver",
           activeId: "workspace.driver",
         },
         },
         {
         {
           key: "/workspace/dict",
           key: "/workspace/dict",
-          label: "dict",
+          label: intl.formatMessage({
+            id: "columns.studio.userdict.title",
+          }),
           activeId: "workspace.dict",
           activeId: "workspace.dict",
         },
         },
       ],
       ],
@@ -304,23 +314,28 @@ const Widget = ({ onSearch }: Props) => {
       children: [
       children: [
         {
         {
           key: "/workspace/team",
           key: "/workspace/team",
-          label: "team",
+          label: intl.formatMessage({
+            id: "columns.studio.group.title",
+          }),
           activeId: "workspace.team",
           activeId: "workspace.team",
         },
         },
         {
         {
           key: "/workspace/invite",
           key: "/workspace/invite",
-          label: "invite",
+          label: intl.formatMessage({
+            id: "columns.studio.invite.title",
+          }),
           activeId: "workspace.invite",
           activeId: "workspace.invite",
         },
         },
         {
         {
           key: "/workspace/transfer",
           key: "/workspace/transfer",
-          label: "transfer",
+          label: intl.formatMessage({
+            id: "columns.studio.transfer.title",
+          }),
           activeId: "workspace.transfer",
           activeId: "workspace.transfer",
         },
         },
       ],
       ],
     },
     },
   ];
   ];
-  console.log("nav", routeId);
   /** 当前选中 */
   /** 当前选中 */
   const selectedKey = findSelectedKey(items, routeId);
   const selectedKey = findSelectedKey(items, routeId);
 
 

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

@@ -8,6 +8,10 @@ const items = {
   "labels.week.6": "Sat",
   "labels.week.6": "Sat",
   "labels.collaborators": "collaborators",
   "labels.collaborators": "collaborators",
   "labels.collaboration": "collaboration",
   "labels.collaboration": "collaboration",
+  "labels.search": "Search",
+  "labels.home": "Home",
+  "labels.documents": "Documents",
+  "labels.tools": "Tools",
   "labels.link": "link",
   "labels.link": "link",
   "labels.library.access.link": "Library access link",
   "labels.library.access.link": "Library access link",
   "labels.library.access.tip":
   "labels.library.access.tip":
@@ -59,6 +63,7 @@ const items = {
   "labels.task": "task",
   "labels.task": "task",
   "labels.task.hall": "task hall",
   "labels.task.hall": "task hall",
   "labels.task.mine": "my task",
   "labels.task.mine": "my task",
+  "labels.task.pending": "Pending",
   "labels.task.my.project": "my projects",
   "labels.task.my.project": "my projects",
   "labels.all": "all",
   "labels.all": "all",
   "labels.mention.me": "mention",
   "labels.mention.me": "mention",

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

@@ -8,6 +8,10 @@ const items = {
   "labels.week.6": "星期六",
   "labels.week.6": "星期六",
   "labels.collaborators": "协作者",
   "labels.collaborators": "协作者",
   "labels.collaboration": "协作",
   "labels.collaboration": "协作",
+  "labels.search": "搜索",
+  "labels.home": "主页",
+  "labels.documents": "文档",
+  "labels.tools": "工具",
   "labels.link": "链接",
   "labels.link": "链接",
   "labels.library.access.link": "藏经阁访问链接",
   "labels.library.access.link": "藏经阁访问链接",
   "labels.library.access.tip": "任何获得此链接的人,都可以在藏经阁中阅读该术语。",
   "labels.library.access.tip": "任何获得此链接的人,都可以在藏经阁中阅读该术语。",
@@ -63,6 +67,7 @@ const items = {
   "labels.task": "任务",
   "labels.task": "任务",
   "labels.task.hall": "任务大厅",
   "labels.task.hall": "任务大厅",
   "labels.task.mine": "我的任务",
   "labels.task.mine": "我的任务",
+  "labels.task.pending": "待办",
   "labels.task.my.project": "我的项目",
   "labels.task.my.project": "我的项目",
   "labels.all": "全部",
   "labels.all": "全部",
   "labels.mention.me": "提及我的",
   "labels.mention.me": "提及我的",