import type { ReactNode } from "react"; import type { Metadata } from "next"; import { Inter, JetBrains_Mono } from "next/font/google"; import { notFound } from "next/navigation"; import { NextIntlClientProvider } from "next-intl"; import { getMessages, getTranslations } from "next-intl/server"; import { routing } from "@/i18n/routing"; import "../globals.css"; const inter = Inter({ subsets: ["latin"], variable: "--font-inter", }); const jetbrainsMono = JetBrains_Mono({ subsets: ["latin"], variable: "--font-mono", }); export function generateStaticParams() { return routing.locales.map((locale) => ({ locale })); } export async function generateMetadata({ params, }: { params: Promise<{ locale: string }>; }): Promise { const { locale } = await params; const t = await getTranslations({ locale, namespace: "metadata" }); return { title: t("title"), description: t("description"), alternates: { languages: Object.fromEntries( routing.locales.map((l) => [l, `/${l}`]) ), }, }; } export default async function LocaleLayout({ children, params, }: { children: ReactNode; params: Promise<{ locale: string }>; }) { const { locale } = await params; if (!routing.locales.includes(locale as "en" | "zh")) { notFound(); } const messages = await getMessages(); return ( {children} ); }