Skip to content

Commit 5b02df9

Browse files
author
Manuel Schächinger
committed
feat: updated next-intl to v4
1 parent db65b84 commit 5b02df9

60 files changed

Lines changed: 487 additions & 324 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/[locale]/(legal)/imprint/page.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Metadata } from 'next';
2-
import { getTranslations, unstable_setRequestLocale } from 'next-intl/server';
2+
import { getTranslations } from 'next-intl/server';
33

44
import { PageProps } from '@app/interfaces';
55
import Address from '@components/atoms/Address';
@@ -21,9 +21,7 @@ export const generateMetadata = async ({ params }: PageProps): Promise<Metadata>
2121
};
2222
};
2323

24-
const ImprintPage = async ({ params }: PageProps) => {
25-
const { locale } = await params;
26-
unstable_setRequestLocale(locale);
24+
const ImprintPage = async () => {
2725
const t = await getTranslations('pages.imprint');
2826

2927
return (

app/[locale]/(legal)/privacy/page.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Metadata } from 'next';
2-
import { getTranslations, unstable_setRequestLocale } from 'next-intl/server';
2+
import { getTranslations } from 'next-intl/server';
33

44
import type { PageProps } from '@app/interfaces';
55
import Address from '@components/atoms/Address';
@@ -22,9 +22,7 @@ export const generateMetadata = async ({ params }: PageProps): Promise<Metadata>
2222
};
2323
};
2424

25-
const PrivacyPage = async ({ params }: PageProps) => {
26-
const { locale } = await params;
27-
unstable_setRequestLocale(locale);
25+
const PrivacyPage = async () => {
2826
const t = await getTranslations('pages.privacy');
2927

3028
return (

app/[locale]/[...rest]/page.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
import { notFound } from 'next/navigation';
2-
import { unstable_setRequestLocale } from 'next-intl/server';
3-
4-
import { PageProps } from '@app/interfaces';
5-
6-
const CatchAllPage = async ({ params }: PageProps) => {
7-
const { locale } = await params;
8-
unstable_setRequestLocale(locale);
92

3+
const CatchAllPage = async () => {
104
notFound();
115
};
126

app/[locale]/about/page.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Metadata } from 'next';
22
import Image from 'next/image';
3-
import { getTranslations, unstable_setRequestLocale } from 'next-intl/server';
3+
import { getTranslations } from 'next-intl/server';
44

55
import wallpaper from '@/public/images/opengraph-schaechinger.jpg';
66
import type { PageProps } from '@app/interfaces';
@@ -25,15 +25,13 @@ export const generateMetadata = async ({ params }: PageProps): Promise<Metadata>
2525
};
2626
};
2727

28-
const AboutPage = async ({ params }: PageProps) => {
29-
const { locale } = await params;
30-
unstable_setRequestLocale(locale);
28+
const AboutPage = async () => {
3129
const t = await getTranslations('pages.about');
3230
const age = getTimeDuration('1991-02-14');
3331
const years = getTimeDuration('2014-02-01');
3432

3533
return (
36-
<PageContainer name="about" narrow>
34+
<PageContainer name="about">
3735
<PageSection id="profile" first dense>
3836
<Breadcrumbs list={[{ title: t('title') }]} />
3937

app/[locale]/certifications/page.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Metadata } from 'next';
2-
import { getTranslations, unstable_setRequestLocale } from 'next-intl/server';
2+
import { getTranslations } from 'next-intl/server';
33

44
import { PageProps } from '@app/interfaces';
55
import Breadcrumbs from '@components/atoms/Breadcumbs';
@@ -19,13 +19,11 @@ export const generateMetadata = async ({ params }: PageProps): Promise<Metadata>
1919
};
2020
};
2121

22-
const CertificationsPage = async ({ params }: PageProps) => {
23-
const { locale } = await params;
24-
unstable_setRequestLocale(locale);
22+
const CertificationsPage = async () => {
2523
const t = await getTranslations('pages.certifications');
2624

2725
return (
28-
<PageContainer name="certifications" narrow>
26+
<PageContainer name="certifications">
2927
<PageSection id="certifications" first>
3028
<Breadcrumbs list={[{ title: t('title') }]} />
3129

app/[locale]/contact/page.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Metadata } from 'next';
2-
import { getTranslations, unstable_setRequestLocale } from 'next-intl/server';
2+
import { getTranslations } from 'next-intl/server';
33
import { ReCaptchaProvider } from 'next-recaptcha-v3';
44

55
import { RECAPTCHA_SITE_KEY } from '@app/config';
@@ -27,11 +27,10 @@ export const dynamic = 'force-dynamic';
2727

2828
const ContactPage = async ({ params }: PageProps) => {
2929
const { locale } = await params;
30-
unstable_setRequestLocale(locale);
3130
const t = await getTranslations('pages.contact');
3231

3332
return (
34-
<PageContainer name="contact" narrow>
33+
<PageContainer name="contact">
3534
<PageSection id="contact" first>
3635
<Breadcrumbs list={[{ title: t('title') }]} />
3736

@@ -62,7 +61,7 @@ const ContactPage = async ({ params }: PageProps) => {
6261
<h2 className="text-h2">{t('types.write.title')}</h2>
6362

6463
<ReCaptchaProvider reCaptchaKey={RECAPTCHA_SITE_KEY} language={locale}>
65-
<ContactForm translations={t.raw('form')} />
64+
<ContactForm translations={t.raw<any>('form')} />
6665
</ReCaptchaProvider>
6766
</div>
6867
</div>

app/[locale]/layout.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Metadata } from 'next';
22
import { NextIntlClientProvider } from 'next-intl';
3-
import { getTranslations, unstable_setRequestLocale } from 'next-intl/server';
3+
import { getTranslations } from 'next-intl/server';
44

55
import { supportedLangs, WEB_HOST } from '@app/config';
66
import { clearSans } from '@app/font';
@@ -44,7 +44,6 @@ export const generateMetadata = async ({ params }: LayoutProps): Promise<Metadat
4444

4545
const RootLayout = async ({ children, params }: LayoutProps) => {
4646
const { locale } = await params;
47-
unstable_setRequestLocale(locale);
4847

4948
return (
5049
<html className={clearSans.variable} lang={locale} dir="ltr" suppressHydrationWarning>

app/[locale]/not-found.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ const LocalizedNotFoundPage = () => {
1919
const t = useTranslations('errors');
2020

2121
return (
22-
<PageContainer name="not-found" narrow>
22+
<PageContainer name="not-found">
2323
<PageSection id="not-found" first>
2424
<h1 className="text-h1">{t('notFound.title')}</h1>
2525

2626
<p className="mb-4">{t('notFound.text')}</p>
2727

2828
<LinkButton href="/" label={t('notFound.goto')} />
2929

30-
<KonamiCode translations={t.raw('konamiCode')} />
30+
<KonamiCode translations={t.raw<any>('konamiCode')} />
3131
</PageSection>
3232
</PageContainer>
3333
);

app/[locale]/now/page.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import type { Metadata } from 'next';
2+
import { getTranslations } from 'next-intl/server';
3+
4+
import type { PageProps } from '@app/interfaces';
5+
import Breadcrumbs from '@components/atoms/Breadcumbs';
6+
import PageContainer from '@components/organisms/PageContainer';
7+
import PageSection from '@components/organisms/PageSection';
8+
import NowList from '@components/organisms/NowList';
9+
import { generatePageMeta } from '@lib/seo';
10+
11+
export const generateMetadata = async ({ params }: PageProps): Promise<Metadata> => {
12+
const { locale } = await params;
13+
const t = await getTranslations('pages.now');
14+
15+
return {
16+
...generatePageMeta('/now', locale),
17+
title: t('title'),
18+
description: t('description'),
19+
};
20+
};
21+
22+
const NowPage = async () => {
23+
const t = await getTranslations('pages.now');
24+
25+
return (
26+
<PageContainer name="now">
27+
<PageSection id="now" first>
28+
<Breadcrumbs list={[{ title: t('title') }]} />
29+
30+
<h1 className="text-h1">{t('pageTitle')}</h1>
31+
32+
<NowList />
33+
</PageSection>
34+
</PageContainer>
35+
);
36+
};
37+
38+
export default NowPage;

app/[locale]/page.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import type { Metadata } from 'next';
2-
import { getTranslations, unstable_setRequestLocale } from 'next-intl/server';
2+
import { getTranslations } from 'next-intl/server';
33

4-
import Link from '@components/atoms/Link';
54
import type { PageProps } from '@app/interfaces';
65
import { getTimeDuration } from '@app/utils';
76
import AvailabilityIndicator from '@components/atoms/AvailabilityIndicator';
87
import HighlightLabel from '@components/atoms/HighlightLabel';
98
import JsonLd from '@components/atoms/JsonLd';
9+
import Link from '@components/atoms/Link';
1010
import LinkButton from '@components/atoms/LinkButton';
1111
import CareerList from '@components/organisms/CareerList';
1212
import CertificationList from '@components/organisms/CertificationList';
@@ -20,20 +20,18 @@ export const generateMetadata = async ({ params }: PageProps): Promise<Metadata>
2020
return generatePageMeta('/', locale);
2121
};
2222

23-
const HomePage = async ({ params }: PageProps) => {
24-
const { locale } = await params;
25-
unstable_setRequestLocale(locale);
23+
const HomePage = async () => {
2624
const t = await getTranslations('pages.home');
27-
25+
2826
const jsonLd = generateProfileJson();
2927
const aboutTextOptions = {
3028
highlight: (label: React.ReactNode) => <HighlightLabel>{label}</HighlightLabel>,
3129
years: getTimeDuration('2014-02-01'),
32-
};
30+
} as any;
3331

3432
return (
3533
<>
36-
<PageContainer name="home" narrow>
34+
<PageContainer name="home">
3735
<PageSection id="about" first>
3836
<h1 className="text-h1">{t('about.title')}</h1>
3937

0 commit comments

Comments
 (0)