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 }) => ( <>