Skip to content

Commit

Permalink
move more text to translations file
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscoBSalgueiro committed May 22, 2024
1 parent 27569ae commit 3be4551
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 9 deletions.
15 changes: 12 additions & 3 deletions src/components/panels/info/InfoPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useToggle } from "@mantine/hooks";
import { invoke } from "@tauri-apps/api";
import { useAtom, useAtomValue, useSetAtom } from "jotai";
import { useContext, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { useStore } from "zustand";
import FenSearch from "./FenSearch";
import FileInfo from "./FileInfo";
Expand All @@ -28,6 +29,8 @@ function InfoPanel() {
const currentTab = useAtomValue(currentTabAtom);
const isReportoire = currentTab?.file?.metadata.type === "repertoire";

const { t } = useTranslation();

const stats = useMemo(() => getTreeStats(root), [root]);

return (
Expand All @@ -51,9 +54,15 @@ function InfoPanel() {
<PgnInput />

<Group>
<Text>Variations: {stats.leafs}</Text>
<Text>Max Depth: {stats.depth}</Text>
<Text>Total moves: {stats.total}</Text>
<Text>
{t("PgnInput.Variations")}: {stats.leafs}
</Text>
<Text>
{t("PgnInput.MaxDepth")}: {stats.depth}
</Text>
<Text>
{t("PgnInput.TotalMoves")}: {stats.total}
</Text>
</Group>
</Stack>
</ScrollArea>
Expand Down
10 changes: 6 additions & 4 deletions src/components/panels/info/PgnInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { IconCheck, IconCopy } from "@tabler/icons-react";
import deepEqual from "fast-deep-equal";
import { useAtom } from "jotai";
import { useContext, useEffect, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { useStore } from "zustand";

function PgnInput() {
Expand All @@ -26,6 +27,7 @@ function PgnInput() {
const headers = useStore(store, (s) => s.headers);
const setState = useStore(store, (s) => s.setState);
const [options, setOptions] = useAtom(currentPgnOptionsAtom);
const { t } = useTranslation();

const realPGN = useMemo(
() =>
Expand Down Expand Up @@ -62,29 +64,29 @@ function PgnInput() {
<Text fw="bold">PGN</Text>
<Group my="sm">
<Checkbox
label="Comments"
label={t("PgnInput.Comments")}
size="xs"
checked={options.comments}
onChange={() =>
setOptions({ ...options, comments: !options.comments })
}
/>
<Checkbox
label="Glyphs"
label={t("PgnInput.Glyphs")}
size="xs"
checked={options.glyphs}
onChange={() => setOptions({ ...options, glyphs: !options.glyphs })}
/>
<Checkbox
label="Variations"
label={t("PgnInput.Variations")}
size="xs"
checked={options.variations}
onChange={() =>
setOptions({ ...options, variations: !options.variations })
}
/>
<Checkbox
label="Extra Markups"
label={t("PgnInput.ExtraMarkups")}
size="xs"
checked={options.extraMarkups}
onChange={() =>
Expand Down
11 changes: 9 additions & 2 deletions src/translation/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export const en_US = {
"Common.Unknown": "Unknown",
"Common.Cancel": "Cancel",
"Common.CannotUndo": "This action cannot be undone.",
"Common.NameAlreadyUsed": "Name is required",
"Common.RequireName": "Name already used",
"Common.NameAlreadyUsed": "Name already used",
"Common.RequireName": "Name is required",
"Common.RequirePath": "Path is required",
"Common.PGNFile": "PGN file",
"Common.PGNGame": "PGN Game",
Expand Down Expand Up @@ -346,5 +346,12 @@ export const en_US = {
"Settings.Directories.Files": "Files directory",
"Settings.Directories.Files.Desc":
"This is where your games in the Files page are stored",

"PgnInput.Comments": "Comments",
"PgnInput.Glyphs": "Glyphs",
"PgnInput.Variations": "Variations",
"PgnInput.ExtraMarkups": "Extra Markups",
"PgnInput.MaxDepth": "Max Depth",
"PgnInput.TotalMoves": "Total Moves",
},
};
7 changes: 7 additions & 0 deletions src/translation/zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,5 +334,12 @@ export const zh_CN = {
"Settings.Directories.Desc": "自定义应用程序使用的目录",
"Settings.Directories.Files": "文件目录",
"Settings.Directories.Files.Desc": "这是你在文件页面中的对局存储的位置",

"PgnInput.Comments": "Comments",
"PgnInput.Glyphs": "Glyphs",
"PgnInput.Variations": "Variations",
"PgnInput.ExtraMarkups": "Extra Markups",
"PgnInput.MaxDepth": "Max Depth",
"PgnInput.TotalMoves": "Total Moves",
},
};

0 comments on commit 3be4551

Please sign in to comment.