Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update with-i18n-routing.mdx with nextjs 15 params change #1401

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions docs/pages/docs/getting-started/app-router/with-i18n-routing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,12 @@ import {getMessages} from 'next-intl/server';

export default async function LocaleLayout({
children,
params: {locale}
params
}: {
children: React.ReactNode;
params: {locale: string};
params: Promise<{locale: string}>;
}) {
const {locale} = await params;
// Providing all messages to the client
// side is the easiest way to get started
const messages = await getMessages();
Expand Down Expand Up @@ -286,7 +287,8 @@ export function generateStaticParams() {
```tsx filename="app/[locale]/layout.tsx"
import {unstable_setRequestLocale} from 'next-intl/server';

export default async function LocaleLayout({children, params: {locale}}) {
export default async function LocaleLayout({children, params}) {
const {locale} = await params;
unstable_setRequestLocale(locale);

return (
Expand All @@ -298,7 +300,8 @@ export default async function LocaleLayout({children, params: {locale}}) {
```tsx filename="app/[locale]/page.tsx"
import {unstable_setRequestLocale} from 'next-intl/server';

export default function IndexPage({params: {locale}}) {
export default function IndexPage({params}) {
const {locale} = await params;
unstable_setRequestLocale(locale);

// Once the request locale is set, you
Expand Down Expand Up @@ -359,7 +362,8 @@ To achieve this, you can forward the `locale` that you receive from Next.js via
```tsx filename="page.tsx"
import {getTranslations} from 'next-intl/server';

export async function generateMetadata({params: {locale}}) {
export async function generateMetadata({params}) {
const {locale} = await params
const t = await getTranslations({locale, namespace: 'Metadata'});

return {
Expand Down
Loading