import type { Metadata } from "next"; import { notFound } from "next/navigation"; import { LocaleProvider } from "../context/LocaleContext"; import type { Locale } from "../context/LocaleContext"; import { getThemeConfig } from "@/config"; import { getThemeMessages } from "@/app/lib/theme-data"; const LOCALES: Locale[] = ["zh", "en"]; export const metadata: Metadata = (() => { const theme = getThemeConfig(); return { title: theme.meta.title, description: theme.meta.description, }; })(); export function generateStaticParams() { return LOCALES.map((locale) => ({ locale })); } export default async function LocaleLayout({ children, params, }: { children: React.ReactNode; params: Promise<{ locale: string }>; }) { const { locale } = await params; if (!LOCALES.includes(locale as Locale)) { notFound(); } const messages = await getThemeMessages(locale as Locale); return ( {children} ); }