From 5e82a5f2d1bc85208ad0671df86acc9921229b76 Mon Sep 17 00:00:00 2001 From: ICEYSELF Date: Mon, 29 Apr 2024 11:18:01 +0800 Subject: [PATCH] translate more things --- .../panels/database/options/LichessOptionsPanel.tsx | 10 +++++++--- src/translation/en_US.ts | 9 +++++++++ src/translation/zh_CN.ts | 9 +++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/components/panels/database/options/LichessOptionsPanel.tsx b/src/components/panels/database/options/LichessOptionsPanel.tsx index 7bf32b0a..a2ec9e3b 100644 --- a/src/components/panels/database/options/LichessOptionsPanel.tsx +++ b/src/components/panels/database/options/LichessOptionsPanel.tsx @@ -2,6 +2,7 @@ import ToggleButtonGroup, { type ToggleButtonGroupOption, } from "@/components/common/ToggleButtonGroup"; import { lichessOptionsAtom } from "@/state/atoms"; +import { capitalize } from "@/utils/format"; import { MIN_DATE } from "@/utils/lichess/api"; import type { LichessGameSpeed, LichessRating } from "@/utils/lichess/explorer"; import { Group, Select, Stack, TextInput } from "@mantine/core"; @@ -15,9 +16,12 @@ import { IconSend, } from "@tabler/icons-react"; import { useAtom } from "jotai"; +import { useTranslation } from "react-i18next"; import { match } from "ts-pattern"; const LichessOptionsPanel = () => { + const { t } = useTranslation(); + const [options, setOptions] = useAtom(lichessOptionsAtom); const timeControls: LichessGameSpeed[] = [ @@ -46,7 +50,7 @@ const LichessOptionsPanel = () => { .exhaustive(); return { content: icon, - name: name, + name: t(`TimeControl.${capitalize(name)}`), value: speed, isToggled: (options.speeds ?? []).some((s) => s === speed), }; @@ -95,14 +99,14 @@ const LichessOptionsPanel = () => { return (