28 lines
642 B
TypeScript
28 lines
642 B
TypeScript
import { notFound } from "next/navigation"
|
|
import { hasLocale, NextIntlClientProvider } from "next-intl"
|
|
import type { ReactNode } from "react"
|
|
|
|
import { routing } from "@/i18n/routing"
|
|
import { Providers } from "../providers"
|
|
|
|
type LocaleLayoutProps = {
|
|
children: ReactNode
|
|
params: Promise<{
|
|
locale: string
|
|
}>
|
|
}
|
|
|
|
export default async function LocaleLayout({ children, params }: LocaleLayoutProps) {
|
|
const { locale } = await params
|
|
|
|
if (!hasLocale(routing.locales, locale)) {
|
|
notFound()
|
|
}
|
|
|
|
return (
|
|
<NextIntlClientProvider locale={locale}>
|
|
<Providers>{children}</Providers>
|
|
</NextIntlClientProvider>
|
|
)
|
|
}
|