Update App.jsx via upload script - 2026-07-29 00:24:49
This commit is contained in:
parent
8df99b0e50
commit
160f9ee109
14
App.jsx
14
App.jsx
|
|
@ -517,6 +517,14 @@ function upsertProductByName(list, product) {
|
||||||
return { list: [...list, product], collision: false, isNew: true, resultId: product.id };
|
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) {
|
function gatherExportTerms(p, categories) {
|
||||||
const cat = (categories || []).find(c => c.id === p.category);
|
const cat = (categories || []).find(c => c.id === p.category);
|
||||||
const terms = new Set(['产品规格书', '* 产品规格如有变动,恕不另行通知', '型号', '品牌', '产品大类']);
|
const terms = new Set(['产品规格书', '* 产品规格如有变动,恕不另行通知', '型号', '品牌', '产品大类']);
|
||||||
|
|
@ -528,6 +536,9 @@ function gatherExportTerms(p, categories) {
|
||||||
rows.forEach(r => {
|
rows.forEach(r => {
|
||||||
if (r.labelKey === '__port__') hasPortRow = true;
|
if (r.labelKey === '__port__') hasPortRow = true;
|
||||||
else terms.add(r.labelKey);
|
else terms.add(r.labelKey);
|
||||||
|
// 数值本身如果混了中文说明文字,也要一起收集去翻译(比如"380/400/415VAC(三相五线)"
|
||||||
|
// 里的"三相五线"),纯数字/英文的值不会被这个判断收进来
|
||||||
|
if (containsChinese(r.value)) terms.add(r.value);
|
||||||
});
|
});
|
||||||
if (hasPortRow) terms.add('输出');
|
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 cat = (categories || []).find(c => c.id === p.category);
|
||||||
const showMachineVariant = isUpsCategory(cat) && p.machineVariant;
|
const showMachineVariant = isUpsCategory(cat) && p.machineVariant;
|
||||||
const L = (key) => (exportLabels && exportLabels[key]) || key;
|
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 langInfo = EXPORT_LANGUAGES.find(l => l.code === exportLang) || EXPORT_LANGUAGES[0];
|
||||||
const exportRows = productExportRows(p, categories);
|
const exportRows = productExportRows(p, categories);
|
||||||
return (
|
return (
|
||||||
|
|
@ -4155,7 +4167,7 @@ function ProductDetail({ product: p, onEdit, onDelete, categories, exportLang, o
|
||||||
{exportRows.map((r, i) => (
|
{exportRows.map((r, i) => (
|
||||||
<tr key={i}>
|
<tr key={i}>
|
||||||
<td className="spec-label">{r.labelKey === '__port__' ? `${r.portType} ${L('输出')}` : L(r.labelKey)}</td>
|
<td className="spec-label">{r.labelKey === '__port__' ? `${r.portType} ${L('输出')}` : L(r.labelKey)}</td>
|
||||||
<td>{r.value}</td>
|
<td>{V(r.value)}</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue