- |
- {placementString(result.placement)}
- |
+ {placementString(result.placement)} |
{result.teamName} |
@@ -221,10 +226,11 @@ function Results() {
}
function Description() {
+ const { t } = useTranslation();
const data = useLoaderData();
return (
-
+
{
@@ -47,7 +48,7 @@ const playersSchema = z
return userIds.length === new Set(userIds).size;
},
{
- message: "Can't have the same player twice in the same team.",
+ message: "forms.errors.duplicatePlayer",
}
);
@@ -85,7 +86,7 @@ const reportWinnersActionSchema = z.object({
)
.refine(
(val) => val.length === new Set(val.map((team) => team.teamName)).size,
- { message: "Each team needs a unique name." }
+ { message: "forms.errors.uniqueTeamName" }
)
),
});
@@ -149,34 +150,37 @@ export const loader = async ({ request, params }: LoaderArgs) => {
};
export default function ReportWinnersPage() {
+ const { t } = useTranslation(["common", "calendar"]);
const data = useLoaderData();
return (
);
}
function ParticipantsCountInput() {
+ const { t } = useTranslation("calendar");
const data = useLoaderData();
return (
();
const [amountOfTeams, setAmountOfTeams] = React.useState(
Math.max(data.winners.length, 1)
@@ -229,7 +234,7 @@ function TeamInputs() {
onClick={() => setAmountOfTeams((amountOfTeams) => amountOfTeams + 1)}
tiny
>
- Add team
+ {t("forms.team.add")}
>
);
@@ -259,6 +264,7 @@ function Team({
initialPlacement: string;
initialValues?: Unpacked ["winners"]>;
}) {
+ const { t } = useTranslation("calendar");
const teamNameId = React.useId();
const placementId = React.useId();
@@ -296,7 +302,7 @@ function Team({
/>
diff --git a/app/routes/calendar/index.tsx b/app/routes/calendar/index.tsx
index 6f6b498a0..6d783fcae 100644
--- a/app/routes/calendar/index.tsx
+++ b/app/routes/calendar/index.tsx
@@ -129,6 +129,7 @@ function fetchEventsOfWeek(args: { week: number; year: number }) {
}
export default function CalendarPage() {
+ const { t } = useTranslation("calendar");
const data = useLoaderData();
const user = useUser();
const isMounted = useIsMounted();
@@ -150,7 +151,7 @@ export default function CalendarPage() {
{user && (
- Add new
+ {t("addNew")}
)}
{isMounted ? (
@@ -159,13 +160,13 @@ export default function CalendarPage() {
<>
- All times in your local time zone:{" "}
+ {t("inYourTimeZone")}{" "}
{Intl.DateTimeFormat().resolvedOptions().timeZone}
>
) : (
- No events this week
+ {t("noEvents")}
)}
>
@@ -230,23 +231,24 @@ function WeekLinkTitle({
}: {
week: Unpacked ["weeks"]>;
}) {
+ const { t } = useTranslation("calendar");
const data = useLoaderData();
const { i18n } = useTranslation();
const relativeWeekIdentifier =
week.number === data.currentWeek
- ? "This"
+ ? t("week.this")
: week.number - data.currentWeek === 1
- ? "Next"
+ ? t("week.next")
: week.number - data.currentWeek === -1
- ? "Last"
+ ? t("week.last")
: null;
if (relativeWeekIdentifier) {
return (
{relativeWeekIdentifier}
- Week
+ {t("week.week")}
);
}
@@ -292,21 +294,18 @@ function getEventsCountPerWeek(
}
function EventsToReport() {
+ const { t } = useTranslation("calendar");
const data = useLoaderData();
if (data.eventsToReport.length === 0) return null;
return (
- You can report results for{" "}
+ {t("reportResults")}{" "}
{data.eventsToReport.map((event, i) => (
{event.name}
- {i === data.eventsToReport.length - 1
- ? ""
- : i === data.eventsToReport.length - 2
- ? " and "
- : ", "}
+ {i === data.eventsToReport.length - 1 ? "" : ", "}
))}
@@ -318,7 +317,7 @@ function EventsList({
}: {
events: UseDataFunctionReturn["events"];
}) {
- const { i18n } = useTranslation();
+ const { t, i18n } = useTranslation("calendar");
return (
@@ -374,7 +373,9 @@ function EventsList({
{calendarEvent.name}{" "}
{calendarEvent.nthAppearance > 1 ? (
- Day {calendarEvent.nthAppearance}
+ {t("day", {
+ number: calendarEvent.nthAppearance,
+ })}
) : null}
diff --git a/app/routes/calendar/new.tsx b/app/routes/calendar/new.tsx
index 5de9658d4..56216f256 100644
--- a/app/routes/calendar/new.tsx
+++ b/app/routes/calendar/new.tsx
@@ -215,12 +215,13 @@ export default function CalendarNewEventPage() {
}
function NameInput() {
+ const { t } = useTranslation();
const { eventToEdit } = useLoaderData ();
return (
|