Skip to content

Commit 151d07e

Browse files
authored
examples: update app-dir-i18n-routing to v15 (#72636)
## Why? The example `app-dir-i18n-routing` needs to be updated to v15. ## How? Run the `next-async-request-api` codemod: ``` pnpm dlx @next/codemod@latest next-async-request-api . ``` - Fixes #72630
1 parent b888c42 commit 151d07e

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

examples/app-dir-i18n-routing/app/[lang]/layout.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
import { i18n, type Locale } from "../../i18n-config";
22

3+
export const metadata = {
4+
title: "i18n within app directory - Vercel Examples",
5+
description: "How to do i18n in Next.js 13 within app directory",
6+
};
7+
38
export async function generateStaticParams() {
49
return i18n.locales.map((locale) => ({ lang: locale }));
510
}
611

7-
export default function Root({
8-
children,
9-
params,
10-
}: {
12+
export default async function Root(props: {
1113
children: React.ReactNode;
12-
params: { lang: Locale };
14+
params: Promise<{ lang: Locale }>;
1315
}) {
16+
const params = await props.params;
17+
18+
const { children } = props;
19+
1420
return (
1521
<html lang={params.lang}>
1622
<body>{children}</body>
1723
</html>
1824
);
1925
}
20-
21-
export const metadata = {
22-
title: "i18n within app directory - Vercel Examples",
23-
description: "How to do i18n in Next.js 13 within app directory",
24-
};

examples/app-dir-i18n-routing/app/[lang]/page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { Locale } from "../../i18n-config";
33
import Counter from "./components/counter";
44
import LocaleSwitcher from "./components/locale-switcher";
55

6-
export default async function IndexPage({
7-
params: { lang },
8-
}: {
9-
params: { lang: Locale };
6+
export default async function IndexPage(props: {
7+
params: Promise<{ lang: Locale }>;
108
}) {
9+
const { lang } = await props.params;
10+
1111
const dictionary = await getDictionary(lang);
1212

1313
return (
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
{
22
"private": true,
33
"scripts": {
4-
"dev": "next",
4+
"dev": "next dev",
55
"build": "next build",
66
"start": "next start"
77
},
88
"dependencies": {
9-
"@formatjs/intl-localematcher": "0.2.32",
10-
"negotiator": "0.6.3",
9+
"@formatjs/intl-localematcher": "0.5.7",
10+
"negotiator": "1.0.0",
1111
"next": "latest",
1212
"react": "^18.2.0",
1313
"react-dom": "^18.2.0",
1414
"server-only": "0.0.1"
1515
},
1616
"devDependencies": {
17-
"@types/negotiator": "0.6.1",
18-
"@types/node": "^18.11.5",
17+
"@types/negotiator": "0.6.3",
18+
"@types/node": "^22.9.0",
1919
"@types/react": "^18.0.23",
2020
"@types/react-dom": "^18.0.7",
21-
"typescript": "^4.8.4"
21+
"typescript": "^5.6.3"
2222
}
2323
}

0 commit comments

Comments
 (0)