From 5f6f04a5463818dd8c114464b0dada09b3addc07 Mon Sep 17 00:00:00 2001 From: SARDONYX-sard <68905624+SARDONYX-sard@users.noreply.github.com> Date: Mon, 6 Nov 2023 03:50:19 +0900 Subject: [PATCH] fix(front): fix localization --- frontend/src/components/form.tsx | 2 +- frontend/src/components/pages/settings.tsx | 12 +++++++++--- locales/en.json | 2 ++ locales/ja.json | 6 ++++-- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/form.tsx b/frontend/src/components/form.tsx index 6b332cd..20dc0ca 100644 --- a/frontend/src/components/form.tsx +++ b/frontend/src/components/form.tsx @@ -356,7 +356,7 @@ export function ConvertForm() { }} onBlur={onBlur} error={Boolean(error)} - helperText={t("")} + helperText={t("convert-form-author-name-helper")} /> )} /> diff --git a/frontend/src/components/pages/settings.tsx b/frontend/src/components/pages/settings.tsx index 810bf1f..f9bb630 100644 --- a/frontend/src/components/pages/settings.tsx +++ b/frontend/src/components/pages/settings.tsx @@ -25,12 +25,13 @@ import "ace-builds/src-noconflict/mode-javascript"; import "ace-builds/src-noconflict/snippets/css"; import "ace-builds/src-noconflict/snippets/javascript"; import "ace-builds/src-noconflict/theme-one_dark"; +import { useTranslation } from "react-i18next"; export default function Settings() { + useLocale(); const [editorMode, setEditorMode] = useStorageState("editorMode", "default"); const [preset, setPreset] = useStorageState("presetNumber", "0"); const [style, setStyle] = useDynStyle(); - useLocale(); const setEditorKeyMode = (editorMode: EditorMode) => { setEditorMode(editorMode ?? "default"); @@ -89,9 +90,13 @@ const CSSEditor = ({ setStyle, style, }: CSSEditorProps) => { + const { t } = useTranslation(); + return ( <> - Custom CSS + + {t("custom-css-label")} + { + const { t } = useTranslation(); const [script, setScript] = useInjectScript(); return ( <> - Custom JavaScript(Please do not execute untrusted scripts) + {t("custom-js-label")}