53 lines
1.3 KiB
TypeScript
53 lines
1.3 KiB
TypeScript
import { Inter, Roboto_Mono } from "next/font/google";
|
|
import "../globals.css";
|
|
import { notFound } from "next/navigation";
|
|
import { locales } from "@/i18n/config";
|
|
import { ThemeProvider } from "@/components/theme-provider";
|
|
import { Navbar } from "@/components/navbar";
|
|
import { unstable_setRequestLocale } from "next-intl/server";
|
|
import { Footer } from "@/components/footer";
|
|
|
|
const inter = Inter({
|
|
subsets: ["latin"],
|
|
variable: "--font-inter",
|
|
});
|
|
|
|
const robotoMono = Roboto_Mono({
|
|
subsets: ["latin"],
|
|
variable: "--font-roboto-mono",
|
|
});
|
|
|
|
export function generateStaticParams() {
|
|
return locales.map((locale) => ({ locale }));
|
|
}
|
|
|
|
export default async function LocaleLayout({
|
|
children,
|
|
params: { locale },
|
|
}: {
|
|
children: React.ReactNode;
|
|
params: { locale: string };
|
|
}) {
|
|
// Validate that the incoming `locale` parameter is valid
|
|
if (!locales.includes(locale as any)) {
|
|
notFound();
|
|
}
|
|
|
|
// Enable static rendering
|
|
unstable_setRequestLocale(locale);
|
|
|
|
return (
|
|
<html lang={locale} suppressHydrationWarning>
|
|
<body className={`${inter.variable} ${robotoMono.variable} antialiased`}>
|
|
<ThemeProvider>
|
|
<Navbar />
|
|
<main className="">
|
|
{children}
|
|
<Footer />
|
|
</main>
|
|
</ThemeProvider>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|