From 9be0c7b1d9887d2d8afd2576d34820de45bd93ac Mon Sep 17 00:00:00 2001 From: miteruzo Date: Sun, 18 Oct 2026 00:20:30 +0900 Subject: [PATCH] #428 --- frontend/src/components/DevModeWatermark.tsx | 7 ++- frontend/src/components/ErrorScreen.tsx | 20 +++---- frontend/src/components/PostFormTagsArea.tsx | 4 +- frontend/src/components/PostList.tsx | 4 +- .../PostOriginalCreatedTimeField.tsx | 15 +++-- frontend/src/components/TagSearch.tsx | 4 +- frontend/src/components/TagSidebar.tsx | 10 ++-- frontend/src/components/TopNav.tsx | 23 ++++---- frontend/src/components/TopNavUser.tsx | 4 +- frontend/src/components/WikiBody.tsx | 7 ++- .../components/posts/PostCoreDataFields.tsx | 5 +- .../components/posts/PostDurationField.tsx | 6 +- .../src/components/posts/PostTextField.tsx | 2 +- .../components/posts/PostThumbnailPreview.tsx | 6 +- .../posts/import/PostImportStatusBadge.tsx | 11 +--- .../import/PostImportThumbnailPreview.tsx | 2 +- frontend/src/lib/i18n.ts | 33 ++++++----- frontend/src/lib/useUITranslation.ts | 10 +++- frontend/src/locales/ain-Kana/common.json | 59 +++++++------------ frontend/src/locales/ain-Kana/errors.json | 8 +++ frontend/src/locales/ain-Kana/help.json | 6 ++ frontend/src/locales/ain-Kana/imports.json | 7 +++ frontend/src/locales/ain-Kana/navigation.json | 2 +- frontend/src/locales/ain-Kana/shared.json | 30 ++++++++++ frontend/src/locales/ain-Kana/tags.json | 10 +--- frontend/src/locales/ain-Kana/wiki.json | 9 +++ frontend/src/locales/ja/errors.json | 7 +++ frontend/src/locales/ja/help.json | 5 ++ frontend/src/locales/ja/imports.json | 6 ++ frontend/src/locales/ja/shared.json | 29 +++++++++ frontend/src/locales/ja/tags.json | 6 +- frontend/src/locales/ja/wiki.json | 8 +++ frontend/src/pages/MorePage.tsx | 4 +- .../deerjikists/DeerjikistDetailPage.tsx | 13 ++-- frontend/src/pages/help/HelpChangesPage.tsx | 18 +++--- frontend/src/pages/help/HelpDetailPage.tsx | 16 +++-- frontend/src/pages/help/HelpDiffPage.tsx | 4 +- frontend/src/pages/help/HelpListPage.tsx | 30 ++++++---- frontend/src/pages/tags/TagListPage.tsx | 8 +-- frontend/src/pages/wiki/WikiDetailPage.tsx | 19 +++--- frontend/src/pages/wiki/WikiDiffPage.tsx | 9 ++- frontend/src/pages/wiki/WikiEditPage.tsx | 19 +++--- frontend/src/pages/wiki/WikiHistoryPage.tsx | 18 +++--- frontend/src/pages/wiki/WikiNewPage.tsx | 17 +++--- frontend/src/pages/wiki/WikiSearchPage.tsx | 14 +++-- 45 files changed, 355 insertions(+), 199 deletions(-) create mode 100644 frontend/src/locales/ain-Kana/errors.json create mode 100644 frontend/src/locales/ain-Kana/help.json create mode 100644 frontend/src/locales/ain-Kana/imports.json create mode 100644 frontend/src/locales/ain-Kana/shared.json create mode 100644 frontend/src/locales/ain-Kana/wiki.json create mode 100644 frontend/src/locales/ja/errors.json create mode 100644 frontend/src/locales/ja/help.json create mode 100644 frontend/src/locales/ja/imports.json create mode 100644 frontend/src/locales/ja/shared.json create mode 100644 frontend/src/locales/ja/wiki.json diff --git a/frontend/src/components/DevModeWatermark.tsx b/frontend/src/components/DevModeWatermark.tsx index 5de8c0b..2bab6c6 100644 --- a/frontend/src/components/DevModeWatermark.tsx +++ b/frontend/src/components/DevModeWatermark.tsx @@ -8,6 +8,8 @@ const COLUMN_COUNT = 12 const DevModeWatermark: FC = () => { + const { t } = useTranslation ('shared') + const text = t ('labels.development', { returnDetails: true }) return ( ))} @@ -44,3 +47,5 @@ const DevModeWatermark: FC = () => { export default DevModeWatermark +import { useTranslation } from 'react-i18next' + diff --git a/frontend/src/components/ErrorScreen.tsx b/frontend/src/components/ErrorScreen.tsx index 8335e56..8792275 100644 --- a/frontend/src/components/ErrorScreen.tsx +++ b/frontend/src/components/ErrorScreen.tsx @@ -4,6 +4,7 @@ import nikumaru from '@/assets/fonts/nikumaru.otf' import errorImg from '@/assets/images/not-found.gif' import MainArea from '@/components/layout/MainArea' import { SITE_TITLE } from '@/config' +import { useUITranslation } from '@/lib/useUITranslation' import type { FC } from 'react' @@ -11,17 +12,16 @@ type Props = { status: number } const ErrorScreen: FC = ({ status }) => { - const [message, rightMsg, leftMsg]: [string, string, string] = (() => { + const { message: translate, label } = useUITranslation ('errors') + const [message]: [string, string, string] = (() => { switch (status) { case 403: - return ['権限ないよ(笑)', '帰れ!', '帰れ!'] case 404: - return ['ページないよ(笑)', '帰れ!', '帰れ!'] case 500: - return ['鯖でエラー出たって(嘲笑)', '管理人に', '聯絡を!'] case 503: - return ['鯖死んでるよ(泣)', '管理人に', '聯絡を!'] + return [translate (`${ status }.message`).text, + translate (`${ status }.right`).text, translate (`${ status }.left`).text] default: throw new Error } @@ -51,13 +51,13 @@ const ErrorScreen: FC = ({ status }) => { style={{ fontFamily: 'Nikumaru' }}>

{status}

-

{leftMsg}

- 逃げたギター -

{rightMsg}

+

{label (`${ status }.left`)}

+ {translate +

{label (`${ status }.right`)}

-

{message}

+

{label (`${ status }.message`)}

) } -export default ErrorScreen \ No newline at end of file +export default ErrorScreen diff --git a/frontend/src/components/PostFormTagsArea.tsx b/frontend/src/components/PostFormTagsArea.tsx index 9d771a3..60425a2 100644 --- a/frontend/src/components/PostFormTagsArea.tsx +++ b/frontend/src/components/PostFormTagsArea.tsx @@ -3,6 +3,7 @@ import { useRef, useState } from 'react' import { useLocale } from '@/lib/useLocale' +import { useUITranslation } from '@/lib/useUITranslation' import TagSearchBox from '@/components/TagSearchBox' import FormField from '@/components/common/FormField' import TextArea from '@/components/common/TextArea' @@ -39,6 +40,7 @@ type Props = Omit, 'value' | 'onChange' | ' const PostFormTagsArea: FC = ({ tags, setTags, errors, ...rest }) => { + const { label } = useUITranslation ('navigation') const locale = useLocale () const ref = useRef (null) @@ -79,7 +81,7 @@ const PostFormTagsArea: FC = ({ tags, setTags, errors, ...rest }) => { } return ( - + {({ describedBy, invalid }) => ( <>