Selaa lähdekoodia

:globe_with_meridians: 在新标签页打开

visuddhinanda 2 vuotta sitten
vanhempi
sitoutus
b330b0e8ef

+ 5 - 1
dashboard/src/components/discussion/DiscussionDrawer.tsx

@@ -7,6 +7,7 @@ import DiscussionListCard, { TResType } from "./DiscussionListCard";
 import { IComment } from "./DiscussionItem";
 import DiscussionAnchor from "./DiscussionAnchor";
 import { Link } from "react-router-dom";
+import { useIntl } from "react-intl";
 
 export interface IAnswerCount {
   id: string;
@@ -24,6 +25,7 @@ const DiscussionDrawerWidget = ({
   resType,
   onCommentCountChange,
 }: IWidget) => {
+  const intl = useIntl();
   const [open, setOpen] = useState(false);
   const [childrenDrawer, setChildrenDrawer] = useState(false);
   const [topicComment, setTopicComment] = useState<IComment>();
@@ -52,7 +54,9 @@ const DiscussionDrawerWidget = ({
         extra={
           <Space>
             <Link to={`/discussion/show/${resType}/${resId}`} target="_blank">
-              在新窗口打开
+              {intl.formatMessage({
+                id: "buttons.open.in.new.tab",
+              })}
             </Link>
             {drawerWidth === drawerMinWidth ? (
               <Button

+ 7 - 1
dashboard/src/components/general/NissayaCard.tsx

@@ -10,6 +10,7 @@ import { ITerm } from "../term/TermEdit";
 import { Link } from "react-router-dom";
 import TermModal from "../term/TermModal";
 import { ITermDataResponse } from "../api/Term";
+import { useIntl } from "react-intl";
 
 const { Paragraph, Title } = Typography;
 
@@ -76,6 +77,7 @@ interface IWidget {
   cache?: boolean;
 }
 const NissayaCardWidget = ({ text, cache = false }: IWidget) => {
+  const intl = useIntl();
   const [cardData, setCardData] = useState<INissayaRelation[]>();
   const [term, setTerm] = useState<ITerm>();
   const [loading, setLoading] = useState(false);
@@ -143,7 +145,11 @@ const NissayaCardWidget = ({ text, cache = false }: IWidget) => {
           />
         </Title>
         <div>
-          <Link to={`/nissaya/ending/${term?.word}`}>在新窗口打开</Link>
+          <Link to={`/nissaya/ending/${term?.word}`}>
+            {intl.formatMessage({
+              id: "buttons.open.in.new.tab",
+            })}
+          </Link>
           <Button
             type="link"
             icon={<ReloadOutlined />}

+ 9 - 5
dashboard/src/components/template/Article.tsx

@@ -1,9 +1,10 @@
-import { Card, Collapse, Modal } from "antd";
+import { Card, Collapse, Modal, Space } from "antd";
 import { Typography } from "antd";
 import { useState } from "react";
 import Article, { ArticleType } from "../article/Article";
 import { Link } from "react-router-dom";
 import { fullUrl } from "../../utils";
+import { useIntl } from "react-intl";
 
 const { Text } = Typography;
 
@@ -31,6 +32,7 @@ export const ArticleCtl = ({
   style = "modal",
   modalExtra,
 }: IWidgetChapterCtl) => {
+  const intl = useIntl();
   const [isModalOpen, setIsModalOpen] = useState(false);
   const showModal = () => {
     setIsModalOpen(true);
@@ -89,12 +91,14 @@ export const ArticleCtl = ({
                 }}
               >
                 <Text>{aTitle}</Text>
-                <Text>
-                  {modalExtra}
+                <Space>
                   <Link to={articleLink} target="_blank">
-                    {"新窗口打开"}
+                    {intl.formatMessage({
+                      id: "buttons.open.in.new.tab",
+                    })}
                   </Link>
-                </Text>
+                  {modalExtra}
+                </Space>
               </div>
             }
             open={isModalOpen}

+ 5 - 1
dashboard/src/components/template/Quote.tsx

@@ -2,6 +2,7 @@ import { Button, Popover } from "antd";
 import { Typography } from "antd";
 import { SearchOutlined, CopyOutlined } from "@ant-design/icons";
 import { ProCard } from "@ant-design/pro-components";
+import { useIntl } from "react-intl";
 
 const { Text, Link } = Typography;
 
@@ -21,6 +22,7 @@ const QuoteCtl = ({
   error,
   message,
 }: IWidgetQuoteCtl) => {
+  const intl = useIntl();
   const show = pali ? pali : paraId;
   let textShow = <></>;
 
@@ -39,7 +41,9 @@ const QuoteCtl = ({
             分栏打开
           </Button>,
           <Button type="link" size="small" icon={<SearchOutlined />}>
-            新窗口打开
+            {intl.formatMessage({
+              id: "buttons.open.in.new.tab",
+            })}
           </Button>,
           <Button type="link" size="small" icon={<CopyOutlined />}>
             复制引用