Files
mypage/app/[locale]/layout.tsx
RJ 101624c4d5
All checks were successful
PR Checks / lint-and-build (pull_request) Successful in 18s
📝 priettier check
2025-12-04 15:57:39 +02:00

32 lines
677 B
TypeScript

import { notFound } from 'next/navigation'
import { setRequestLocale } from 'next-intl/server'
import { routing } from '@/src/i18n/routing'
import { ReactNode } from 'react'
type Props = {
children: ReactNode
breadcrumbs: ReactNode
params: Promise<{ locale: string }>
}
export function generateStaticParams() {
return routing.locales.map(locale => ({ locale }))
}
export default async function LocaleLayout({ children, breadcrumbs, params }: Props) {
const { locale } = await params
if (!routing.locales.includes(locale as any)) {
notFound()
}
setRequestLocale(locale)
return (
<>
{breadcrumbs}
<main>{children}</main>
</>
)
}