Skip to content

Commit 262abf4

Browse files
committed
add: Translated the shared form components
1 parent 58b3dd9 commit 262abf4

7 files changed

Lines changed: 26 additions & 8 deletions

File tree

dashboard/src/components/form/ChannelPicker.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { type ChannelSummary } from "@testify/shared";
2+
import { useTranslation } from "react-i18next";
23
import { Field } from "@/components/form/Field";
34
import { SELECT } from "@/components/form/fieldStyles";
45
import { Warning } from "@/components/form/Warning";
@@ -15,7 +16,7 @@ export function ChannelPicker({
1516
label,
1617
hint,
1718
allowNone = true,
18-
noneLabel = "Where they were talking",
19+
noneLabel,
1920
}: {
2021
channels: ChannelSummary[];
2122
value: string | null;
@@ -25,6 +26,7 @@ export function ChannelPicker({
2526
allowNone?: boolean;
2627
noneLabel?: string;
2728
}): React.JSX.Element {
29+
const { t } = useTranslation();
2830
const postable = postableChannels(channels);
2931
const chosen = postable.find((channel) => channel.id === value);
3032

@@ -37,7 +39,7 @@ export function ChannelPicker({
3739
onChange(event.target.value === "" ? null : event.target.value);
3840
}}
3941
>
40-
{allowNone && <option value="">{noneLabel}</option>}
42+
{allowNone && <option value="">{noneLabel ?? t("common.whereTalking")}</option>}
4143
{postable.map((channel) => (
4244
<option key={channel.id} value={channel.id} disabled={!channel.canSend}>
4345
#{channel.name}

dashboard/src/components/form/CheckList.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useId, type ReactNode } from "react";
2+
import { useTranslation } from "react-i18next";
23
import { CHECK_ROW, FIELD_GROUP, LABEL, SCROLL_LIST } from "@/components/form/fieldStyles";
34
import { cn } from "@/lib/cn";
45

@@ -26,6 +27,7 @@ export function CheckList({
2627
max: number;
2728
onChange: (ids: string[]) => void;
2829
}): React.JSX.Element {
30+
const { t } = useTranslation();
2931
const atLimit = value.length >= max;
3032
const nameId = `checklist-${useId()}`;
3133

@@ -38,7 +40,7 @@ export function CheckList({
3840
</span>
3941
{hint !== undefined && <span className="text-muted-foreground text-xs">{hint}</span>}
4042
<span className="text-muted-foreground text-xs tabular-nums" aria-live="polite">
41-
{value.length} of {max} chosen
43+
{t("common.chosen", { count: value.length, max })}
4244
</span>
4345
</span>
4446

dashboard/src/components/form/SavingIndicator.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { Check, Loader2 } from "lucide-react";
2+
import { useTranslation } from "react-i18next";
23
import { cn } from "@/lib/cn";
34

45
export type SavingState = "idle" | "saving" | "saved";
56

67
/** Idle → Saving → Saved, announced politely so a screen reader hears the outcome without stealing focus. */
78
export function SavingIndicator({ state }: { state: SavingState }): React.JSX.Element {
9+
const { t } = useTranslation();
810
return (
911
<span
1012
className={cn(
@@ -17,7 +19,7 @@ export function SavingIndicator({ state }: { state: SavingState }): React.JSX.El
1719
>
1820
{state === "saving" && <Loader2 size={13} className="animate-spin" aria-hidden="true" />}
1921
{state === "saved" && <Check size={13} aria-hidden="true" />}
20-
{state === "saving" ? "Saving…" : state === "saved" ? "Saved" : ""}
22+
{state === "saving" ? t("common.savingEllipsis") : state === "saved" ? t("common.saved") : ""}
2123
</span>
2224
);
2325
}

dashboard/src/i18n/locales/de.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828
"couldNotRun": "Das konnte nicht ausgeführt werden.",
2929
"didNotWork": "Das hat nicht funktioniert.",
3030
"discordRefused": "Discord hat das abgelehnt.",
31-
"unknownAccount": "Unbekanntes Konto"
31+
"unknownAccount": "Unbekanntes Konto",
32+
"chosen": "{{count}} von {{max}} ausgewählt",
33+
"whereTalking": "Wo gerade geschrieben wurde",
34+
"savingEllipsis": "Wird gespeichert…"
3235
},
3336
"nav": {
3437
"servers": "Server",

dashboard/src/i18n/locales/en.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828
"couldNotRun": "That could not be run.",
2929
"didNotWork": "That did not work.",
3030
"discordRefused": "Discord refused that.",
31-
"unknownAccount": "Unknown account"
31+
"unknownAccount": "Unknown account",
32+
"chosen": "{{count}} of {{max}} chosen",
33+
"whereTalking": "Where they were talking",
34+
"savingEllipsis": "Saving…"
3235
},
3336
"nav": {
3437
"servers": "Servers",

dashboard/src/i18n/locales/es.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
"couldNotRun": "No se ha podido ejecutar.",
3030
"didNotWork": "No ha funcionado.",
3131
"discordRefused": "Discord lo ha rechazado.",
32-
"unknownAccount": "Cuenta desconocida"
32+
"unknownAccount": "Cuenta desconocida",
33+
"chosen": "{{count}} de {{max}} elegidos",
34+
"whereTalking": "Donde estaban hablando",
35+
"savingEllipsis": "Guardando…"
3336
},
3437
"nav": {
3538
"servers": "Servidores",

dashboard/src/i18n/locales/fr.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
"couldNotRun": "Impossible d’exécuter.",
3030
"didNotWork": "Cela n’a pas fonctionné.",
3131
"discordRefused": "Discord a refusé.",
32-
"unknownAccount": "Compte inconnu"
32+
"unknownAccount": "Compte inconnu",
33+
"chosen": "{{count}} sur {{max}} sélectionnés",
34+
"whereTalking": "Là où la conversation avait lieu",
35+
"savingEllipsis": "Enregistrement…"
3336
},
3437
"nav": {
3538
"servers": "Serveurs",

0 commit comments

Comments
 (0)