32 lines
998 B
TypeScript
32 lines
998 B
TypeScript
import { LOCALES } from "@/i18n/routing";
|
||
import { redirect } from "next/navigation";
|
||
|
||
// 重定向到 /about/company
|
||
export default async function Page({
|
||
params,
|
||
}: {
|
||
params: Promise<{ locale: string }>;
|
||
}) {
|
||
const { locale } = await params;
|
||
return redirect(`/${locale}/about/company`);
|
||
}
|
||
|
||
// 关键:生成locale + section的所有静态组合(覆盖vi/organization等)
|
||
export async function generateStaticParams() {
|
||
const sections = ['company', 'awards', 'base', 'culture', 'history', 'organization'];
|
||
|
||
// 确保LOCALES包含"vi"(越南语),否则会生成undefined!
|
||
if (!LOCALES.includes("vi")) {
|
||
console.warn("⚠️ LOCALES does not include 'vi'! Add it to fix /vi/about/* paths.");
|
||
// 临时兜底:如果没有vi,手动添加(或检查你的i18n/routing.ts)
|
||
// LOCALES.push("vi");
|
||
}
|
||
|
||
// 生成所有locale × section的组合
|
||
return LOCALES.flatMap((locale) =>
|
||
sections.map((section) => ({
|
||
locale,
|
||
section,
|
||
}))
|
||
);
|
||
} |