diff --git a/TODO.md b/TODO.md index 6c9df2402..fe0ea2a0e 100644 --- a/TODO.md +++ b/TODO.md @@ -19,7 +19,7 @@ Calendar - [x] Winners on the event info page - [x] There should be a banner on the list page if you have past tournaments to report - [x] On the user page tab showing past results -- [ ] Translations +- [x] Translations ## Other diff --git a/app/components/FormErrors.tsx b/app/components/FormErrors.tsx index 2e00a7dd6..366e9ecbf 100644 --- a/app/components/FormErrors.tsx +++ b/app/components/FormErrors.tsx @@ -1,6 +1,8 @@ import { useActionData } from "@remix-run/react"; +import { useTranslation } from "react-i18next"; -export function FormErrors() { +export function FormErrors({ namespace }: { namespace: "calendar" }) { + const { t } = useTranslation(["common", namespace]); const actionData = useActionData<{ errors?: string[] }>(); if (!actionData?.errors || actionData.errors.length === 0) { @@ -9,10 +11,10 @@ export function FormErrors() { return (
-

Following errors need to be fixed:

+

{t("common:forms.errors.title")}:

    {actionData.errors.map((error) => ( -
  1. {error}
  2. +
  3. {t(`${namespace}:${error}` as any)}
  4. ))}
diff --git a/app/routes/calendar/$id/index.tsx b/app/routes/calendar/$id/index.tsx index 577ab7c94..4f77cd126 100644 --- a/app/routes/calendar/$id/index.tsx +++ b/app/routes/calendar/$id/index.tsx @@ -73,7 +73,7 @@ export const loader = async ({ params, request }: LoaderArgs) => { export default function CalendarEventPage() { const user = useUser(); const data = useLoaderData(); - const { i18n } = useTranslation(); + const { i18n, t } = useTranslation(["common", "calendar"]); const isMounted = useIsMounted(); return ( @@ -87,7 +87,9 @@ export default function CalendarEventPage() { hidden: data.event.startTimes.length === 1, })} > - Day {i + 1} + {t("calendar:day", { + number: i + 1, + })}