import { notFound } from 'next/navigation'; import { I18N_CONFIG } from '@nice/i18n'; interface Props { children: React.ReactNode; params: Promise<{ locale: string }>; } // 使用统一的 i18n 配置 const { supportedLocales } = I18N_CONFIG; // 生成静态参数 export async function generateStaticParams() { return supportedLocales.map((locale) => ({ locale })); } export default async function LocaleLayout({ children, params }: Props) { // 等待 params 解析 const { locale } = await params; // 验证语言参数 if (!(supportedLocales as readonly string[]).includes(locale)) { notFound(); } // 在客户端设置 HTML lang 属性 return ( <>