Skip to content

Commit

Permalink
translate more things
Browse files Browse the repository at this point in the history
  • Loading branch information
chuigda committed Apr 29, 2024
1 parent 9bc6632 commit 5e82a5f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/panels/database/options/LichessOptionsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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[] = [
Expand Down Expand Up @@ -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),
};
Expand Down Expand Up @@ -95,14 +99,14 @@ const LichessOptionsPanel = () => {
return (
<Stack justify="flex-start">
<ToggleButtonGroup
label="Time control"
label={t("Board.Database.TimeControl")}
options={timeControls.map(mapTimeControl)}
toggleOption={toggleTimeControl}
minButtonWidth="9ch"
includeTooltips
/>
<ToggleButtonGroup
label="Average rating"
label={t("Board.Database.AverageRating")}
options={ratings.map(mapRatingOption)}
toggleOption={toggleRating}
minButtonWidth="9ch"
Expand Down
9 changes: 9 additions & 0 deletions src/translation/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ export const en_US = {
"RichText.Link": "Link",
"RichText.RemoveLink": "Remove link",

"TimeControl.UltraBullet": "UltraBullet",
"TimeControl.Bullet": "Bullet",
"TimeControl.Blitz": "Blitz",
"TimeControl.Rapid": "Rapid",
"TimeControl.Classical": "Classical",
"TimeControl.Correspondence": "Correspondence",

"Menu.File": "File",
"Menu.File.NewTab": "New Tab",
"Menu.File.OpenFile": "Open File",
Expand Down Expand Up @@ -178,6 +185,8 @@ export const en_US = {
"Board.Database.NoReference2": "Please",
"Board.Database.SelectReference": "add a database",
"Board.Database.NoReference3": "first and mark it as the reference.",
"Board.Database.TimeControl": "Time control",
"Board.Database.AverageRating": "Average rating",
"Board.Annotate.WriteHere": "Write here...",

"Engines.Title": "Your Engines",
Expand Down
9 changes: 9 additions & 0 deletions src/translation/zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ export const zh_CN = {
"RichText.Link": "链接",
"RichText.RemoveLink": "移除链接",

"TimeControl.UltraBullet": "UltraBullet",
"TimeControl.Bullet": "超超快棋",
"TimeControl.Blitz": "超快棋",
"TimeControl.Rapid": "快棋",
"TimeControl.Classical": "慢棋",
"TimeControl.Correspondence": "通讯棋",

"Menu.File": "文件",
"Menu.File.NewTab": "新建标签页",
"Menu.File.OpenFile": "打开文件",
Expand Down Expand Up @@ -178,6 +185,8 @@ export const zh_CN = {
"Board.Database.NoReference2": "请先",
"Board.Database.SelectReference": "添加一个数据库",
"Board.Database.NoReference3": "并将其作为参考",
"Board.Database.TimeControl": "时间控制",
"Board.Database.AverageRating": "平均等级分",
"Board.Annotate.WriteHere": "在这里写评注...",

"Engines.Title": "引擎管理",
Expand Down

0 comments on commit 5e82a5f

Please sign in to comment.