From 160f9ee1090b2023613bc9fe0258a0d334f06d96 Mon Sep 17 00:00:00 2001 From: mike Date: Wed, 29 Jul 2026 00:25:12 +0800 Subject: [PATCH] Update App.jsx via upload script - 2026-07-29 00:24:49 --- App.jsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/App.jsx b/App.jsx index d9e3244..bfe9559 100644 --- a/App.jsx +++ b/App.jsx @@ -517,6 +517,14 @@ function upsertProductByName(list, product) { return { list: [...list, product], collision: false, isNew: true, resultId: product.id }; } +// 判断一段文字里有没有中文字符——用来决定"这个数值要不要走翻译":纯数字/英文的技术写法 +// (比如 220V、50Hz、12V9AH*1)不用碰,只有真的混了中文说明文字(比如"三相五线"、"非凝露" +// 这种AI从原文里保留下来的注释)才需要送去翻译,避免不分青红皂白地把所有数值都送去翻译、 +// 反而影响本来就没问题的技术数值的准确性。 +function containsChinese(str) { + return /[\u4e00-\u9fa5]/.test(String(str || '')); +} + function gatherExportTerms(p, categories) { const cat = (categories || []).find(c => c.id === p.category); const terms = new Set(['产品规格书', '* 产品规格如有变动,恕不另行通知', '型号', '品牌', '产品大类']); @@ -528,6 +536,9 @@ function gatherExportTerms(p, categories) { rows.forEach(r => { if (r.labelKey === '__port__') hasPortRow = true; else terms.add(r.labelKey); + // 数值本身如果混了中文说明文字,也要一起收集去翻译(比如"380/400/415VAC(三相五线)" + // 里的"三相五线"),纯数字/英文的值不会被这个判断收进来 + if (containsChinese(r.value)) terms.add(r.value); }); if (hasPortRow) terms.add('输出'); // 对客卖点/主要特点:每行一条,都是要给客户看的文字,需要翻译 @@ -4099,6 +4110,7 @@ function ProductDetail({ product: p, onEdit, onDelete, categories, exportLang, o const cat = (categories || []).find(c => c.id === p.category); const showMachineVariant = isUpsCategory(cat) && p.machineVariant; const L = (key) => (exportLabels && exportLabels[key]) || key; + const V = (value) => (containsChinese(value) ? L(value) : value); const langInfo = EXPORT_LANGUAGES.find(l => l.code === exportLang) || EXPORT_LANGUAGES[0]; const exportRows = productExportRows(p, categories); return ( @@ -4155,7 +4167,7 @@ function ProductDetail({ product: p, onEdit, onDelete, categories, exportLang, o {exportRows.map((r, i) => ( {r.labelKey === '__port__' ? `${r.portType} ${L('输出')}` : L(r.labelKey)} - {r.value} + {V(r.value)} ))}