From 6630b0677109158bafaf9109df605fc72dba8042 Mon Sep 17 00:00:00 2001 From: Micha de Vries Date: Mon, 15 Apr 2024 00:03:33 +0200 Subject: [PATCH] Add missing translations --- .../events/[id]/[subpage]/page.tsx | 12 +- .../events/[id]/[subpage]/settings.tsx | 16 ++- .../(public)/account/create-profile/page.tsx | 18 ++- src/app/[locale]/(public)/e/[event]/page.tsx | 44 ++++--- .../e/[event]/registration/[id]/page.tsx | 50 +++++--- .../[locale]/(public)/get-started/page.tsx | 23 ---- .../(public)/o/[organisation]/page.tsx | 36 ++++-- src/components/data/events/cards.tsx | 6 +- src/lib/branding.ts | 3 + src/locales/en/components.json | 6 + src/locales/en/pages.json | 107 +++++++++++++++++- src/locales/nl/components.json | 6 + src/locales/nl/pages.json | 107 +++++++++++++++++- 13 files changed, 352 insertions(+), 82 deletions(-) delete mode 100644 src/app/[locale]/(public)/get-started/page.tsx diff --git a/src/app/[locale]/(console)/organisation/[organisation]/events/[id]/[subpage]/page.tsx b/src/app/[locale]/(console)/organisation/[organisation]/events/[id]/[subpage]/page.tsx index 7ad4144..f39aa2f 100644 --- a/src/app/[locale]/(console)/organisation/[organisation]/events/[id]/[subpage]/page.tsx +++ b/src/app/[locale]/(console)/organisation/[organisation]/events/[id]/[subpage]/page.tsx @@ -111,15 +111,19 @@ export default function Account() { /> - Overview - Attendees - Events + + {t('page.overview.title')} + + + {t('page.attendees.title')} + + {t('page.events.title')} {organisation.can_manage && ( - Settings + {t('page.settings.title')} )} diff --git a/src/app/[locale]/(console)/organisation/[organisation]/events/[id]/[subpage]/settings.tsx b/src/app/[locale]/(console)/organisation/[organisation]/events/[id]/[subpage]/settings.tsx index 0d8b1ee..17e2d6b 100644 --- a/src/app/[locale]/(console)/organisation/[organisation]/events/[id]/[subpage]/settings.tsx +++ b/src/app/[locale]/(console)/organisation/[organisation]/events/[id]/[subpage]/settings.tsx @@ -15,6 +15,7 @@ import { Actor } from '@/schema/resources/actor'; import { Event } from '@/schema/resources/event'; import { zodResolver } from '@hookform/resolvers/zod'; import { AlertOctagon, Loader2 } from 'lucide-react'; +import { useTranslations } from 'next-intl'; import { useParams } from 'next/navigation'; import React, { useCallback } from 'react'; import { useForm } from 'react-hook-form'; @@ -28,6 +29,9 @@ export function EventSettingsTab({ event: Event; refetch: () => unknown; }) { + const t = useTranslations( + 'pages.console.organisation.events.page.settings' + ); const { mutateAsync } = useUpdateEvent(event.id); const onSubmit = useCallback( async (payload: Partial) => { @@ -76,30 +80,30 @@ export function EventSettingsTab({ - Change logo + {t('change-logo.trigger')} } /> - Change banner + {t('change-banner.trigger')} } /> diff --git a/src/app/[locale]/(public)/account/create-profile/page.tsx b/src/app/[locale]/(public)/account/create-profile/page.tsx index b5c25bd..e285ee4 100644 --- a/src/app/[locale]/(public)/account/create-profile/page.tsx +++ b/src/app/[locale]/(public)/account/create-profile/page.tsx @@ -18,6 +18,7 @@ import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { useSurreal } from '@/lib/Surreal'; import { useAuth } from '@/lib/auth'; +import { privacy_policy } from '@/lib/branding'; import { useFeatureFlags } from '@/lib/featureFlags'; import { cn } from '@/lib/utils'; import { useWebAuthnAvailable } from '@/lib/webauthn'; @@ -27,6 +28,7 @@ import { zodResolver } from '@hookform/resolvers/zod'; import jwt from 'jsonwebtoken'; import { Info, Loader2, XCircle } from 'lucide-react'; import { useTranslations } from 'next-intl'; +import Link from 'next/link'; import { useSearchParams } from 'next/navigation'; import React, { useEffect, useState } from 'react'; import { useForm } from 'react-hook-form'; @@ -209,13 +211,27 @@ export default function CreateProfile() { )} - + + {privacy_policy && ( +

+ {t.rich('privacy-policy', { + link: (children) => ( + + {children} + + ), + })} +

+ )}
diff --git a/src/app/[locale]/(public)/e/[event]/page.tsx b/src/app/[locale]/(public)/e/[event]/page.tsx index 945bdab..4312e36 100644 --- a/src/app/[locale]/(public)/e/[event]/page.tsx +++ b/src/app/[locale]/(public)/e/[event]/page.tsx @@ -32,7 +32,7 @@ import { import { linkToProfile } from '@/schema/resources/profile'; import { useQuery } from '@tanstack/react-query'; import { Share } from 'lucide-react'; -import { useLocale } from 'next-intl'; +import { useLocale, useTranslations } from 'next-intl'; import { useParams } from 'next/navigation'; import React, { Fragment, useMemo, useState } from 'react'; import { z } from 'zod'; @@ -41,6 +41,7 @@ export default function Page() { const params = useParams(); const slug = Array.isArray(params.event) ? params.event[0] : params.event; const share = useShare(); + const t = useTranslations('pages.e.index'); const locale = useLocale(); const order = useState<'desc' | 'asc'>('asc'); @@ -71,7 +72,7 @@ export default function Page() { if (isPending) return ; - if (!data || !data.event) return ; + if (!data || !data.event) return ; const { event, @@ -164,7 +165,7 @@ export default function Page() { 'bg-white/10 backdrop-blur hover:bg-white/20' )} > - Manage + {t('banner.manage')} )} {!event.is_tournament && ( @@ -181,8 +182,8 @@ export default function Page() { className={buttonVariants()} > {registration - ? 'Manage registration' - : 'Register'} + ? t('banner.registration.manage') + : t('banner.registration.register')} )} @@ -192,7 +193,9 @@ export default function Page() { {events.length > 0 && (
-

Events

+

+ {t('details.title')} +

- About the{' '} - {event.is_tournament ? 'tournament' : 'event'} + {t( + event.is_tournament + ? 'details.about.title-tournament' + : 'details.about.title-event' + )}

{event.computed.description && (
@@ -219,7 +225,7 @@ export default function Page() { {event.start && (

- Start of event + {t('details.about.start')}

@@ -229,7 +235,7 @@ export default function Page() { {event.end && (

- End of event + {t('details.about.end')}

@@ -239,7 +245,7 @@ export default function Page() { {tournament && (

- Tournament + {t('details.about.tournament')}

-

Location

+

+ {t('details.about.location')} +