46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import { Roboto } from "next/font/google";
|
|
import clsx from "clsx";
|
|
import { NextIntlClientProvider } from "next-intl";
|
|
import { getMessages, setRequestLocale } from "next-intl/server";
|
|
import { notFound } from "next/navigation";
|
|
import { locales } from "@/i18n/config";
|
|
import StoreProvider from "../StoreProvider";
|
|
import "../globals.css";
|
|
|
|
const roboto = Roboto({
|
|
subsets: ["latin"],
|
|
weight: ["300", "400", "500", "700"],
|
|
variable: "--font-roboto",
|
|
});
|
|
|
|
export function generateStaticParams() {
|
|
return locales.map((locale) => ({ locale }));
|
|
}
|
|
|
|
export default async function LocaleLayout({
|
|
children,
|
|
params,
|
|
}: {
|
|
children: React.ReactNode;
|
|
params: { locale: string };
|
|
}) {
|
|
const { locale } = params;
|
|
|
|
if (!locales.includes(locale as any)) notFound();
|
|
|
|
setRequestLocale(locale);
|
|
const messages = await getMessages();
|
|
|
|
return (
|
|
<html lang={locale}>
|
|
<StoreProvider>
|
|
<body className={clsx("antialiased font-roboto", roboto.variable)}>
|
|
<NextIntlClientProvider locale={locale} messages={messages}>
|
|
{children}
|
|
</NextIntlClientProvider>
|
|
</body>
|
|
</StoreProvider>
|
|
</html>
|
|
);
|
|
}
|