Procházet zdrojové kódy

Localization comment delete modal

satof3 před 2 roky
rodič
revize
a8dc1e57a0

+ 2 - 1
apps/app/public/static/locales/en_US/translation.json

@@ -334,7 +334,8 @@
     "add_a_comment": "Add a comment",
     "add_a_comment": "Add a comment",
     "display_the_page_when_posting_this_comment": "Display the page when posting this comment",
     "display_the_page_when_posting_this_comment": "Display the page when posting this comment",
     "no_user_found": "No user found",
     "no_user_found": "No user found",
-    "reply": "Reply"
+    "reply": "Reply",
+    "delete_comment": "Delete comment?"
   },
   },
   "page_api_error": {
   "page_api_error": {
     "notfound_or_forbidden": "Original page is not found or forbidden.",
     "notfound_or_forbidden": "Original page is not found or forbidden.",

+ 2 - 1
apps/app/public/static/locales/ja_JP/translation.json

@@ -367,7 +367,8 @@
     "add_a_comment": "コメントを追加",
     "add_a_comment": "コメントを追加",
     "display_the_page_when_posting_this_comment": "投稿時のページを表示する",
     "display_the_page_when_posting_this_comment": "投稿時のページを表示する",
     "no_user_found": "ユーザー名が見つかりません",
     "no_user_found": "ユーザー名が見つかりません",
-    "reply": "返信"
+    "reply": "返信",
+    "delete_comment": "コメントを削除しますか?"
   },
   },
   "page_api_error": {
   "page_api_error": {
     "notfound_or_forbidden": "元のページが見つからないか、アクセス権がありません。",
     "notfound_or_forbidden": "元のページが見つからないか、アクセス権がありません。",

+ 2 - 1
apps/app/public/static/locales/zh_CN/translation.json

@@ -324,7 +324,8 @@
     "add_a_comment": "Add a comment",
     "add_a_comment": "Add a comment",
     "display_the_page_when_posting_this_comment": "Display the page when posting this comment",
     "display_the_page_when_posting_this_comment": "Display the page when posting this comment",
     "no_user_found": "未找到用户名",
     "no_user_found": "未找到用户名",
-    "reply": "Reply"
+    "reply": "Reply",
+    "delete_comment": "Delete comment?"
   },
   },
   "page_api_error": {
   "page_api_error": {
     "notfound_or_forbidden": "未找到或禁止原始页。",
     "notfound_or_forbidden": "未找到或禁止原始页。",

+ 9 - 5
apps/app/src/components/PageComment/DeleteCommentModal.tsx

@@ -3,11 +3,13 @@ import React from 'react';
 import { isPopulated } from '@growi/core';
 import { isPopulated } from '@growi/core';
 import { UserPicture } from '@growi/ui/dist/components';
 import { UserPicture } from '@growi/ui/dist/components';
 import { format } from 'date-fns';
 import { format } from 'date-fns';
+import { t } from 'i18next';
+import { useTranslation } from 'next-i18next';
 import {
 import {
   Button, Modal, ModalHeader, ModalBody, ModalFooter,
   Button, Modal, ModalHeader, ModalBody, ModalFooter,
 } from 'reactstrap';
 } from 'reactstrap';
 
 
-import { ICommentHasId } from '../../interfaces/comment';
+import type { ICommentHasId } from '../../interfaces/comment';
 import { Username } from '../User/Username';
 import { Username } from '../User/Username';
 
 
 import styles from './DeleteCommentModal.module.scss';
 import styles from './DeleteCommentModal.module.scss';
@@ -26,6 +28,8 @@ export const DeleteCommentModal = (props: DeleteCommentModalProps): JSX.Element
     isShown, comment, errorMessage, cancelToDelete, confirmToDelete,
     isShown, comment, errorMessage, cancelToDelete, confirmToDelete,
   } = props;
   } = props;
 
 
+  const { t } = useTranslation();
+
   const headerContent = () => {
   const headerContent = () => {
     if (comment == null || isShown === false) {
     if (comment == null || isShown === false) {
       return <></>;
       return <></>;
@@ -33,7 +37,7 @@ export const DeleteCommentModal = (props: DeleteCommentModalProps): JSX.Element
     return (
     return (
       <span>
       <span>
         <span className="material-symbols-outlined">delete_forever</span>
         <span className="material-symbols-outlined">delete_forever</span>
-        Delete comment?
+        {t('page_comment.delete_comment')}
       </span>
       </span>
     );
     );
   };
   };
@@ -58,7 +62,7 @@ export const DeleteCommentModal = (props: DeleteCommentModalProps): JSX.Element
 
 
     return (
     return (
       <>
       <>
-        <UserPicture user={creator} size="xs" /> <strong><Username user={creator}></Username></strong> wrote on {commentDate}:
+        <UserPicture user={creator} size="xs" /> <strong className="me-2"><Username user={creator}></Username></strong>{commentDate}:
         <p className="card custom-card comment-body mt-2 p-2">{commentBodyElement}</p>
         <p className="card custom-card comment-body mt-2 p-2">{commentBodyElement}</p>
       </>
       </>
     );
     );
@@ -71,10 +75,10 @@ export const DeleteCommentModal = (props: DeleteCommentModalProps): JSX.Element
     return (
     return (
       <>
       <>
         <span className="text-danger">{errorMessage}</span>&nbsp;
         <span className="text-danger">{errorMessage}</span>&nbsp;
-        <Button onClick={cancelToDelete}>Cancel</Button>
+        <Button onClick={cancelToDelete}>{t('Cancel')}</Button>
         <Button color="danger" onClick={confirmToDelete}>
         <Button color="danger" onClick={confirmToDelete}>
           <span className="material-symbols-outlined">delete_forever</span>
           <span className="material-symbols-outlined">delete_forever</span>
-          Delete
+          {t('Delete')}
         </Button>
         </Button>
       </>
       </>
     );
     );