init
This commit is contained in:
32
app/[locale]/about/page.tsx
Normal file
32
app/[locale]/about/page.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
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,
|
||||
}))
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user