Files
fad-trade-next/app/[locale]/about/page.tsx

32 lines
998 B
TypeScript
Raw Normal View History

import { LOCALES } from "@/i18n/routing";
import { redirect } from "next/navigation";
2025-11-21 13:36:06 +08:00
// 重定向到 /about/company
export default async function Page({
2025-11-21 13:36:06 +08:00
params,
}: {
params: Promise<{ locale: string }>;
}) {
2025-11-21 13:36:06 +08:00
const { locale } = await params;
return redirect(`/${locale}/about/company`);
2025-11-21 13:36:06 +08:00
}
// 关键生成locale + section的所有静态组合覆盖vi/organization等
2025-11-21 13:36:06 +08:00
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,
}))
);
}