mirror of
https://github.com/HugeFrog24/shakethefrog.git
synced 2026-03-02 00:14:33 +00:00
29 lines
745 B
TypeScript
29 lines
745 B
TypeScript
import { NextIntlClientProvider } from 'next-intl';
|
|
import { getMessages } from 'next-intl/server';
|
|
import { notFound } from 'next/navigation';
|
|
import { locales } from '../../i18n/request';
|
|
|
|
export default async function LocaleLayout({
|
|
children,
|
|
params
|
|
}: {
|
|
children: React.ReactNode;
|
|
params: Promise<{ locale: string }>;
|
|
}) {
|
|
const { locale } = await params;
|
|
|
|
// Ensure that the incoming `locale` is valid
|
|
if (!locales.includes(locale as (typeof locales)[number])) {
|
|
notFound();
|
|
}
|
|
|
|
// Providing all messages to the client
|
|
// side is the easiest way to get started
|
|
const messages = await getMessages();
|
|
|
|
return (
|
|
<NextIntlClientProvider messages={messages}>
|
|
{children}
|
|
</NextIntlClientProvider>
|
|
);
|
|
} |