Przeglądaj źródła

:globe_with_meridians: 通用于我的Studio

visuddhinanda 2 lat temu
rodzic
commit
fbe1e54f6b

+ 8 - 1
dashboard/src/components/channel/ChannelSelect.tsx

@@ -6,6 +6,7 @@ import { currentUser } from "../../reducers/current-user";
 import { get } from "../../request";
 import { get } from "../../request";
 import { IApiResponseChannelList } from "../api/Channel";
 import { IApiResponseChannelList } from "../api/Channel";
 import { IStudio } from "../auth/Studio";
 import { IStudio } from "../auth/Studio";
+import { useIntl } from "react-intl";
 
 
 interface IOption {
 interface IOption {
   value: string;
   value: string;
@@ -39,6 +40,7 @@ const ChannelSelectWidget = ({
   onSelect,
   onSelect,
 }: IWidget) => {
 }: IWidget) => {
   const user = useAppSelector(currentUser);
   const user = useAppSelector(currentUser);
+  const intl = useIntl();
   return (
   return (
     <ProFormCascader
     <ProFormCascader
       width={width}
       width={width}
@@ -66,7 +68,12 @@ const ChannelSelectWidget = ({
 
 
           if (user && user.id === parentStudioId) {
           if (user && user.id === parentStudioId) {
             if (!user.roles?.includes("basic")) {
             if (!user.roles?.includes("basic")) {
-              channels.push({ value: "", label: "通用于我的Studio" });
+              channels.push({
+                value: "",
+                label: intl.formatMessage({
+                  id: "term.general-in-studio",
+                }),
+              });
             }
             }
           }
           }
 
 

+ 9 - 3
dashboard/src/components/term/TermEdit.tsx

@@ -403,12 +403,16 @@ const TermEditWidget = ({
             allowClear
             allowClear
             label="版本(已经建立的术语,版本不可修改。可以选择另存为复制到另一个版本。)"
             label="版本(已经建立的术语,版本不可修改。可以选择另存为复制到另一个版本。)"
             width="md"
             width="md"
-            placeholder="通用于我的Studio"
+            placeholder={intl.formatMessage({
+              id: "term.general-in-studio",
+            })}
             disabled={channelDisable}
             disabled={channelDisable}
             options={[
             options={[
               {
               {
                 value: "",
                 value: "",
-                label: "通用于我的Studio",
+                label: intl.formatMessage({
+                  id: "term.general-in-studio",
+                }),
                 disabled:
                 disabled:
                   user?.id !== parentStudioId || user?.roles?.includes("basic"),
                   user?.id !== parentStudioId || user?.roles?.includes("basic"),
               },
               },
@@ -467,7 +471,9 @@ const TermEditWidget = ({
             parentStudioId={parentStudioId}
             parentStudioId={parentStudioId}
             width="md"
             width="md"
             name="copy_channel"
             name="copy_channel"
-            placeholder="通用于我的Studio"
+            placeholder={intl.formatMessage({
+              id: "term.general-in-studio",
+            })}
             allowClear={user?.roles?.includes("basic") ? false : true}
             allowClear={user?.roles?.includes("basic") ? false : true}
             tooltip={intl.formatMessage({
             tooltip={intl.formatMessage({
               id: "term.fields.channel.tooltip",
               id: "term.fields.channel.tooltip",

+ 7 - 1
dashboard/src/components/term/TermItem.tsx

@@ -18,6 +18,7 @@ import { click, clickedTerm } from "../../reducers/term-click";
 import store from "../../store";
 import store from "../../store";
 import "../article/article.css";
 import "../article/article.css";
 import Discussion from "../discussion/Discussion";
 import Discussion from "../discussion/Discussion";
+import { useIntl } from "react-intl";
 
 
 const { Text } = Typography;
 const { Text } = Typography;
 
 
@@ -30,6 +31,7 @@ const TermItemWidget = ({ data, onTermClick }: IWidget) => {
   const [showDiscussion, setShowDiscussion] = useState(false);
   const [showDiscussion, setShowDiscussion] = useState(false);
   const navigate = useNavigate();
   const navigate = useNavigate();
   const termClicked = useAppSelector(clickedTerm);
   const termClicked = useAppSelector(clickedTerm);
+  const intl = useIntl();
 
 
   useEffect(() => {
   useEffect(() => {
     console.debug("on redux", termClicked, data);
     console.debug("on redux", termClicked, data);
@@ -58,7 +60,11 @@ const TermItemWidget = ({ data, onTermClick }: IWidget) => {
             </Space>
             </Space>
             <Space style={{ fontSize: "80%" }}>
             <Space style={{ fontSize: "80%" }}>
               <StudioName data={data?.studio} />
               <StudioName data={data?.studio} />
-              {data?.channel ? data.channel.name : "通用于此studio"}
+              {data?.channel
+                ? data.channel.name
+                : intl.formatMessage({
+                    id: "term.general-in-studio",
+                  })}
               <Text type="secondary">
               <Text type="secondary">
                 <UserName {...data?.editor} />
                 <UserName {...data?.editor} />
               </Text>
               </Text>

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

@@ -11,6 +11,7 @@ const items = {
   "term.fields.meaning2.label": "other meanings",
   "term.fields.meaning2.label": "other meanings",
   "term.fields.meaning2.tooltip": "其他意思将出现在后面的括号里",
   "term.fields.meaning2.tooltip": "其他意思将出现在后面的括号里",
   "term.fields.note.label": "note",
   "term.fields.note.label": "note",
+  "term.general-in-studio": "general in studio",
 };
 };
 
 
 export default items;
 export default items;

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

@@ -11,6 +11,7 @@ const items = {
   "term.fields.meaning2.label": "其他意思",
   "term.fields.meaning2.label": "其他意思",
   "term.fields.meaning2.tooltip": "其他意思将出现在后面的括号里",
   "term.fields.meaning2.tooltip": "其他意思将出现在后面的括号里",
   "term.fields.note.label": "注释",
   "term.fields.note.label": "注释",
+  "term.general-in-studio": "通用于我的Studio",
 };
 };
 
 
 export default items;
 export default items;