feat(i18n): 更新中英文翻译及国际化支持
- 在Workshop和Line模块中添加新的翻译字段 - 修复页面中硬编码的文本,改为使用翻译 - 更新产品线和车间展示的英文翻译内容 - 为卡片组件添加locale属性传递
This commit is contained in:
@@ -110,7 +110,7 @@ export default async function Page({
|
||||
}) {
|
||||
const { locale } = await params;
|
||||
// 获取翻译(确保服务端/客户端一致)
|
||||
const t = await getTranslations({ locale, namespace: "Workshop" });
|
||||
const t = await getTranslations({ locale, namespace: "Line" });
|
||||
|
||||
// 获取产品线数据(顶层 await,Server Component 原生支持)
|
||||
const products: Line[] = await getLines(locale);
|
||||
@@ -129,7 +129,7 @@ export default async function Page({
|
||||
{products.map((product) => {
|
||||
// 用稳定的 key(优先用唯一标识,如 id;无 id 则用 title+locale 避免 index 导致的问题)
|
||||
const stableKey = `${product.title}-${product.locale}`;
|
||||
return <ProductCard key={stableKey} product={product} />;
|
||||
return <ProductCard key={stableKey} product={{ ...product, locale }} />;
|
||||
})}
|
||||
</div>
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user