From 9fe0943df5bbb82f16e17b047ab588d6d74292ed Mon Sep 17 00:00:00 2001 From: Hessel van Bakel Date: Sun, 14 Apr 2024 23:05:34 +0200 Subject: [PATCH 1/2] team translations added translations to the team page --- .../team/[team]/(container)/members/page.tsx | 2 +- .../team/[team]/(container)/overview/page.tsx | 19 +++++---- .../team/[team]/(container)/settings/page.tsx | 28 +++++++------ .../[locale]/(console)/team/[team]/layout.tsx | 14 ++++--- src/locales/en/pages.json | 41 +++++++++++++++++++ src/locales/nl/pages.json | 41 +++++++++++++++++++ 6 files changed, 118 insertions(+), 27 deletions(-) diff --git a/src/app/[locale]/(console)/team/[team]/(container)/members/page.tsx b/src/app/[locale]/(console)/team/[team]/(container)/members/page.tsx index d5584ba..8cb1b7f 100644 --- a/src/app/[locale]/(console)/team/[team]/(container)/members/page.tsx +++ b/src/app/[locale]/(console)/team/[team]/(container)/members/page.tsx @@ -38,7 +38,7 @@ export default function Account() { const params = useParams(); const slug = Array.isArray(params.team) ? params.team[0] : params.team; const { isPending, data, refetch } = useData(slug); - const t = useTranslations('pages.console.organisation.members'); + const t = useTranslations('pages.console.team.members'); if (!data?.team) return ; const team = data.team; diff --git a/src/app/[locale]/(console)/team/[team]/(container)/overview/page.tsx b/src/app/[locale]/(console)/team/[team]/(container)/overview/page.tsx index c937728..5b810c5 100644 --- a/src/app/[locale]/(console)/team/[team]/(container)/overview/page.tsx +++ b/src/app/[locale]/(console)/team/[team]/(container)/overview/page.tsx @@ -16,8 +16,13 @@ import { useParams } from 'next/navigation'; import React from 'react'; import { z } from 'zod'; import { PageTitle } from '../../components/PageTitle'; +import { useTranslations } from 'next-intl'; +import { title } from 'process'; export default function Account() { + const t = useTranslations( + 'pages.console.team.overview' + ); const params = useParams(); const slug = Array.isArray(params.team) ? params.team[0] : params.team; @@ -33,13 +38,13 @@ export default function Account() { return (
- +

- Registrations + {t('registrations')}

{registration_count >= 6 - ? `View all ${registration_count} registrations` - : 'View all registrations'} + ? t("registration-count.multiple", {registration_count}) + : t("registration-count.single")}
@@ -66,7 +71,7 @@ export default function Account() {
-

Members

+

{t('members')}

{player_count >= 6 - ? `View all ${player_count} members` - : 'View all members'} + ? t("member-count.multiple") + : t("member-count.single")}
diff --git a/src/app/[locale]/(console)/team/[team]/(container)/settings/page.tsx b/src/app/[locale]/(console)/team/[team]/(container)/settings/page.tsx index fb4e2d9..a8b2b53 100644 --- a/src/app/[locale]/(console)/team/[team]/(container)/settings/page.tsx +++ b/src/app/[locale]/(console)/team/[team]/(container)/settings/page.tsx @@ -24,6 +24,9 @@ import { z } from 'zod'; import { PageTitle } from '../../components/PageTitle'; export default function Account() { + const t = useTranslations( + 'pages.console.team.settings' + ); const params = useParams(); const slug = Array.isArray(params.team) ? params.team[0] : params.team; const { isPending, data: team, refetch } = useTeam({ slug }); @@ -34,39 +37,38 @@ export default function Account() { ) : team ? (
- +
-

Team Logo

+

{t("logo.title")}

- This is the public logo of your team, shown all - throughout {brand_name}. + {t("logo.description")}

) : ( - + ); } diff --git a/src/app/[locale]/(console)/team/[team]/layout.tsx b/src/app/[locale]/(console)/team/[team]/layout.tsx index 26b440d..62b3116 100644 --- a/src/app/[locale]/(console)/team/[team]/layout.tsx +++ b/src/app/[locale]/(console)/team/[team]/layout.tsx @@ -11,10 +11,14 @@ import { useAuth } from '@/lib/auth'; import { useRouter } from '@/locales/navigation'; import { User } from '@/schema/resources/user'; import { ArrowLeft } from 'lucide-react'; +import { useTranslations } from 'next-intl'; import { useParams } from 'next/navigation'; import React, { ReactNode, useEffect } from 'react'; export default function TeamLayout({ children }: { children: ReactNode }) { + const t = useTranslations( + 'pages.console.team' + ); const router = useRouter(); const params = useParams(); const slug = Array.isArray(params.team) ? params.team[0] : params.team; @@ -41,12 +45,10 @@ export default function TeamLayout({ children }: { children: ReactNode }) { - Overview - - Registrations - - Members - Settings + {t("overview.title")} + {t("registration.title")} + {t("members.title")} + {t("settings.title")}
diff --git a/src/locales/en/pages.json b/src/locales/en/pages.json index 2e2b456..99d6269 100644 --- a/src/locales/en/pages.json +++ b/src/locales/en/pages.json @@ -559,6 +559,47 @@ "confirmed": "Registration confirmed!" } } + }, + "team": { + "overview": { + "title": "Overview", + "registrations": "Registrations", + "members": "Members", + "registration-count": { + "single": "View registrations", + "multiple": "View all {registration_count} registrations" + }, + "member-count": { + "single": "View members", + "multiple": "View all {player_count} members" + } + }, + "registration": { + "title": "Registrations" + }, + "members": { + "title": "Members", + "not_found": "Team not found" + }, + "settings": { + "title": "Settings", + "not_found": "Team not found", + "logo": { + "title": "Team Logo", + "description": "This is the public logo of your team, shown all throughout {brand_name}.", + "change": "change logo" + }, + "name": { + "title": "Team name", + "description": "This is the public name of your team, shown all throughout {brand_name}.", + "submit": "Save name" + }, + "description": { + "title": "Team description", + "description": "This is the public description of your team, shown all throughout {brand_name}.", + "submit": "Save description" + } + } } }, "account": { diff --git a/src/locales/nl/pages.json b/src/locales/nl/pages.json index 08a6ad8..5d92be3 100644 --- a/src/locales/nl/pages.json +++ b/src/locales/nl/pages.json @@ -559,6 +559,47 @@ }, "user-not-found": "Gebruiker niet gevonden" } + }, + "team": { + "overview": { + "member-count": { + "multiple": "Bekijk alle {player_count} leden", + "single": "Bekijk leden" + }, + "members": "Leden", + "registration-count": { + "multiple": "Bekijk alle {registration_count} registraties", + "single": "Bekijk registraties" + }, + "registrations": "Registraties", + "title": "Overzicht" + }, + "members": { + "not_found": "Team niet gevonden", + "title": "Leden" + }, + "registration": { + "title": "Registraties" + }, + "settings": { + "description": { + "description": "Dit is de openbare beschrijving van je team, die overal in {brand_name} wordt weergegeven.", + "submit": "Beschrijving opslaan", + "title": "Teambeschrijving" + }, + "logo": { + "change": "logo wijzigen", + "description": "Dit is het openbare logo van je team, dat overal in {brand_name} wordt weergegeven.", + "title": "Teamlogo" + }, + "name": { + "description": "Dit is de openbare naam van je team, die overal in {brand_name} wordt weergegeven.", + "submit": "Naam opslaan", + "title": "Teamnaam" + }, + "not_found": "Team niet gevonden", + "title": "Instellingen" + } } }, "account": { From 4c5fcedb5b625df49bfb18163c2d1174cfc49196 Mon Sep 17 00:00:00 2001 From: Micha de Vries Date: Sun, 14 Apr 2024 23:15:21 +0200 Subject: [PATCH 2/2] linting --- .../team/[team]/(container)/overview/page.tsx | 21 +++++++------ .../team/[team]/(container)/settings/page.tsx | 31 ++++++++----------- .../[locale]/(console)/team/[team]/layout.tsx | 20 +++++++----- 3 files changed, 37 insertions(+), 35 deletions(-) diff --git a/src/app/[locale]/(console)/team/[team]/(container)/overview/page.tsx b/src/app/[locale]/(console)/team/[team]/(container)/overview/page.tsx index 5b810c5..25ea9b2 100644 --- a/src/app/[locale]/(console)/team/[team]/(container)/overview/page.tsx +++ b/src/app/[locale]/(console)/team/[team]/(container)/overview/page.tsx @@ -12,17 +12,14 @@ import { Team } from '@/schema/resources/team'; import { User } from '@/schema/resources/user'; import { useQuery } from '@tanstack/react-query'; import { ArrowRight } from 'lucide-react'; +import { useTranslations } from 'next-intl'; import { useParams } from 'next/navigation'; import React from 'react'; import { z } from 'zod'; import { PageTitle } from '../../components/PageTitle'; -import { useTranslations } from 'next-intl'; -import { title } from 'process'; export default function Account() { - const t = useTranslations( - 'pages.console.team.overview' - ); + const t = useTranslations('pages.console.team.overview'); const params = useParams(); const slug = Array.isArray(params.team) ? params.team[0] : params.team; @@ -53,8 +50,10 @@ export default function Account() { })} > {registration_count >= 6 - ? t("registration-count.multiple", {registration_count}) - : t("registration-count.single")} + ? t('registration-count.multiple', { + registration_count, + }) + : t('registration-count.single')}
@@ -71,7 +70,9 @@ export default function Account() {
-

{t('members')}

+

+ {t('members')} +

{player_count >= 6 - ? t("member-count.multiple") - : t("member-count.single")} + ? t('member-count.multiple') + : t('member-count.single')}
diff --git a/src/app/[locale]/(console)/team/[team]/(container)/settings/page.tsx b/src/app/[locale]/(console)/team/[team]/(container)/settings/page.tsx index a8b2b53..59d13c1 100644 --- a/src/app/[locale]/(console)/team/[team]/(container)/settings/page.tsx +++ b/src/app/[locale]/(console)/team/[team]/(container)/settings/page.tsx @@ -11,7 +11,6 @@ import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { useTeam, useUpdateTeam } from '@/lib/Queries/Team'; import { useSurreal } from '@/lib/Surreal'; -import { brand_name } from '@/lib/branding'; import { useRouter } from '@/locales/navigation'; import { Team } from '@/schema/resources/team'; import { zodResolver } from '@hookform/resolvers/zod'; @@ -24,9 +23,7 @@ import { z } from 'zod'; import { PageTitle } from '../../components/PageTitle'; export default function Account() { - const t = useTranslations( - 'pages.console.team.settings' - ); + const t = useTranslations('pages.console.team.settings'); const params = useParams(); const slug = Array.isArray(params.team) ? params.team[0] : params.team; const { isPending, data: team, refetch } = useTeam({ slug }); @@ -37,38 +34,36 @@ export default function Account() { ) : team ? (
- +
-

{t("logo.title")}

-

- {t("logo.description")} -

+

{t('logo.title')}

+

{t('logo.description')}

) : ( - + ); } diff --git a/src/app/[locale]/(console)/team/[team]/layout.tsx b/src/app/[locale]/(console)/team/[team]/layout.tsx index 62b3116..c8bc888 100644 --- a/src/app/[locale]/(console)/team/[team]/layout.tsx +++ b/src/app/[locale]/(console)/team/[team]/layout.tsx @@ -16,9 +16,7 @@ import { useParams } from 'next/navigation'; import React, { ReactNode, useEffect } from 'react'; export default function TeamLayout({ children }: { children: ReactNode }) { - const t = useTranslations( - 'pages.console.team' - ); + const t = useTranslations('pages.console.team'); const router = useRouter(); const params = useParams(); const slug = Array.isArray(params.team) ? params.team[0] : params.team; @@ -45,10 +43,18 @@ export default function TeamLayout({ children }: { children: ReactNode }) { - {t("overview.title")} - {t("registration.title")} - {t("members.title")} - {t("settings.title")} + + {t('overview.title')} + + + {t('registration.title')} + + + {t('members.title')} + + + {t('settings.title')} +