From 14f0cdf6fd9ac243730e9f3d65ff7931320f62f3 Mon Sep 17 00:00:00 2001 From: William Oprandi Date: Tue, 22 Oct 2024 23:38:40 +0200 Subject: [PATCH] More i18n --- src/components/boards/Board.tsx | 28 ++++++++++++++-------- src/components/common/CompleteMoveCell.tsx | 12 ++++++---- src/components/panels/info/FenInput.tsx | 17 +++++++------ src/components/tabs/NewTabHome.tsx | 2 +- src/translation/en_US.ts | 23 ++++++++++++++++++ src/translation/fr_FR.ts | 24 +++++++++++++++++++ 6 files changed, 83 insertions(+), 23 deletions(-) diff --git a/src/components/boards/Board.tsx b/src/components/boards/Board.tsx index eac438a8..bcd0ddcf 100644 --- a/src/components/boards/Board.tsx +++ b/src/components/boards/Board.tsx @@ -362,13 +362,13 @@ function Board({ } onClick={() => setViewPawnStructure(!viewPawnStructure)} > - Toggle Pawn Structure View + {t("Board.Action.TogglePawnStructureView")} } onClick={() => takeSnapshot()} > - Take Snapshot + {t("Board.Action.TakeSnapshot")} @@ -384,9 +384,11 @@ function Board({ )} {currentTab?.type === "analysis" ? ( @@ -397,7 +399,7 @@ function Board({ {!eraseDrawablesOnClick && ( - + )} {!disableVariations && ( - + + saveFile()} size="lg" @@ -435,13 +439,17 @@ function Board({ )} {addGame && currentTab?.file && ( - + addGame()}> )} - + @@ -116,28 +118,28 @@ function CompleteMoveCell({ leftSection={} onClick={() => setStart(movePath)} > - Mark as start + {t("Menu.MarkAsStart")} )} } onClick={() => promoteToMainline(movePath)} > - Promote to Main Line + {t("Menu.PromoteToMainLine")} } onClick={() => promoteVariation(movePath)} > - Promote Variation + {t("Menu.PromoteVariation")} } onClick={() => copyVariationPgn(movePath)} > - Copy Variation PGN + {t("Menu.CopyVariationPGN")} } onClick={() => deleteMove(movePath)} > - Delete Move + {t("Menu.DeleteMove")} diff --git a/src/components/panels/info/FenInput.tsx b/src/components/panels/info/FenInput.tsx index 1fb61114..fbf76c12 100644 --- a/src/components/panels/info/FenInput.tsx +++ b/src/components/panels/info/FenInput.tsx @@ -1,11 +1,12 @@ import { TreeStateContext } from "@/components/common/TreeStateContext"; import { getCastlingSquare, swapMove } from "@/utils/chessops"; import { Button, Checkbox, Group, Select, Stack, Text } from "@mantine/core"; +import { type Setup, SquareSet } from "chessops"; import { EMPTY_FEN, INITIAL_FEN, makeFen, parseFen } from "chessops/fen"; import { memo, useCallback, useContext, useEffect, useMemo } from "react"; +import { useTranslation } from "react-i18next"; import { useStore } from "zustand"; import FenSearch from "./FenSearch"; -import { SquareSet, type Setup } from "chessops"; type Castlingrights = { k: boolean; @@ -116,6 +117,8 @@ function FenInput({ currentFen }: { currentFen: string }) { setFen(makeFen({ ...setup, castlingRights: newCastlingRights })); }, [blackCastling, setCastlingRights, setup, whiteCastling, setFen]); + const { t } = useTranslation(); + return ( @@ -124,17 +127,17 @@ function FenInput({ currentFen }: { currentFen: string }) {