feat(i18n): 更新中英文翻译及国际化支持

- 在Workshop和Line模块中添加新的翻译字段
- 修复页面中硬编码的文本,改为使用翻译
- 更新产品线和车间展示的英文翻译内容
- 为卡片组件添加locale属性传递
This commit is contained in:
砂糖
2026-02-03 17:18:13 +08:00
parent 86c20e5ef7
commit e7a428d8f0
7 changed files with 65 additions and 44 deletions

View File

@@ -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" });
// 获取产品线数据(顶层 awaitServer 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>
) : (