This commit is contained in:
2026-01-29 22:51:56 +01:00
parent 506c8682fe
commit 51565fdf41
47 changed files with 117 additions and 70 deletions

View File

@@ -159,83 +159,93 @@ function guessColumnKey(row: ExcelRow, patterns: RegExp[]): string | null {
}
function technicalFullLabel(args: { key: string; excelKey: string; locale: 'en' | 'de' }): string {
const key = args.key;
if (args.locale === 'de') {
switch (key) {
case 'cond_mat': return 'Leitermaterial';
case 'cond_class': return 'Leiterklasse';
case 'core_ins': return 'Aderisolation';
case 'field_ctrl': return 'Feldsteuerung';
case 'screen': return 'Schirm';
case 'long_water': return 'Längswasserdichtigkeit';
case 'trans_water': return 'Querwasserdichtigkeit';
case 'sheath_mat': return 'Mantelmaterial';
case 'sheath_color': return 'Mantelfarbe';
case 'flame_ret': return 'Flammwidrigkeit';
case 'uv_res': return 'UV-beständig';
case 'max_cond_temp': return 'Max. zulässige Leitertemperatur';
case 'out_temp_fixed': return 'Zul. Kabelaußentemperatur, fest verlegt';
case 'out_temp_motion': return 'Zul. Kabelaußentemperatur, in Bewegung';
case 'max_sc_temp_val': return 'Maximale Kurzschlußtemperatur';
case 'min_bend_fixed': return 'Min. Biegeradius, fest verlegt';
case 'min_lay_temp_val': return 'Mindesttemperatur Verlegung';
case 'meter_mark': return 'Metermarkierung';
case 'partial_dis': return 'Teilentladung';
case 'cap': return 'Kapazität';
case 'X': return 'Reaktanz';
case 'test_volt': return 'Prüfspannung';
case 'rated_volt': return 'Nennspannung';
case 'temp_range': return 'Temperaturbereich';
case 'Wm': return 'Manteldicke';
case 'Wi': return 'Isolationsdicke';
case 'RI': return 'DC-Leiterwiderstand (20 °C)';
case 'Ø': return 'Außen-Ø';
case 'Rbv': return 'Biegeradius';
case 'cpr': return 'CPR-Klasse';
case 'flame': return 'Flammhemmend';
case 'G': return 'Gewicht';
case 'Fzv': return 'Zugkraft';
}
} else {
switch (key) {
case 'cond_mat': return 'Conductor material';
case 'cond_class': return 'Conductor class';
case 'core_ins': return 'Core insulation';
case 'field_ctrl': return 'Field control';
case 'screen': return 'Screen';
case 'long_water': return 'Longitudinal water tightness';
case 'trans_water': return 'Transverse water tightness';
case 'sheath_mat': return 'Sheath material';
case 'sheath_color': return 'Sheath color';
case 'flame_ret': return 'Flame retardancy';
case 'uv_res': return 'UV resistant';
case 'max_cond_temp': return 'Max. permissible conductor temperature';
case 'out_temp_fixed': return 'Permissible cable outer temperature, fixed';
case 'out_temp_motion': return 'Permissible cable outer temperature, in motion';
case 'max_sc_temp_val': return 'Maximum short-circuit temperature';
case 'min_bend_fixed': return 'Min. bending radius, fixed';
case 'min_lay_temp_val': return 'Minimum laying temperature';
case 'meter_mark': return 'Meter marking';
case 'partial_dis': return 'Partial discharge';
case 'cap': return 'Capacitance';
case 'X': return 'Reactance';
case 'test_volt': return 'Test voltage';
case 'rated_volt': return 'Rated voltage';
case 'temp_range': return 'Operating temperature range';
case 'Wm': return 'Sheath thickness';
case 'Wi': return 'Insulation thickness';
case 'RI': return 'DC resistance (20 °C)';
case 'Ø': return 'Outer diameter';
case 'Rbv': return 'Bending radius';
case 'cpr': return 'CPR class';
case 'flame': return 'Flame retardant';
case 'G': return 'Weight';
case 'Fzv': return 'Pulling force';
}
}
// Fallback for unmapped keys (should be rare if columnMapping is comprehensive)
const raw = normalizeValue(args.excelKey);
if (!raw) return '';
if (args.locale === 'de') {
return raw
.replace(/\(approx\.?\)/gi, '(ca.)')
.replace(/\bconductor material\b/gi, 'Leitermaterial')
.replace(/\bconductor class\b/gi, 'Leiterklasse')
.replace(/\bcore insulation\b/gi, 'Aderisolation')
.replace(/\binsulation\b/gi, 'Aderisolation')
.replace(/\bfield control\b/gi, 'Feldsteuerung')
.replace(/\bscreen\b/gi, 'Schirm')
.replace(/\blongitudinal water tightness\b/gi, 'Längswasserdichtigkeit')
.replace(/\btransverse water tightness\b/gi, 'Querwasserdichtigkeit')
.replace(/\bsheath material\b/gi, 'Mantelmaterial')
.replace(/\bsheath color\b/gi, 'Mantelfarbe')
.replace(/\bflame retardancy\b/gi, 'Flammwidrigkeit')
.replace(/\buv resistant\b/gi, 'UV-bestandig')
.replace(/\bmax\.? permissible conductor temperature\b/gi, 'Max. zulässige Leitertemperatur')
.replace(/\bpermissible cable outer temperature, fixed\b/gi, 'Zul. Kabelaußentemperatur, fest verlegt')
.replace(/\bpermissible cable outer temperature, in motion\b/gi, 'Zul. Kabelaußentemperatur, in Bewegung')
.replace(/\bmaximum short-circuit temperature\b/gi, 'Maximale Kurzschlußtemperatur')
.replace(/\bmin\.? bending radius, fixed\b/gi, 'Min. Biegeradius, fest verlegt')
.replace(/\bminimum laying temperature\b/gi, 'Mindesttemperatur Verlegung')
.replace(/\bmeter marking\b/gi, 'Metermarkierung')
.replace(/\bpartial discharge\b/gi, 'Teilentladung')
.replace(/\bcapacitance\b/gi, 'Kapazität')
.replace(/\binductance\b/gi, 'Induktivität')
.replace(/\breactance\b/gi, 'Reaktanz')
.replace(/\btest voltage\b/gi, 'Prüfspannung')
.replace(/\brated voltage\b/gi, 'Nennspannung')
.replace(/\boperating temperature range\b/gi, 'Temperaturbereich')
.replace(/\bminimum sheath thickness\b/gi, 'Manteldicke (min.)')
.replace(/\bsheath thickness\b/gi, 'Manteldicke')
.replace(/\bnominal insulation thickness\b/gi, 'Isolationsdicke (nom.)')
.replace(/\binsulation thickness\b/gi, 'Isolationsdicke')
.replace(/\bdc resistance at 20\s*°?c\b/gi, 'DC-Leiterwiderstand (20 °C)')
.replace(/\bouter diameter(?: of cable)?\b/gi, 'Außen-Ø')
.replace(/\bbending radius\b/gi, 'Biegeradius')
.replace(/\bpackaging\b/gi, 'Verpackung')
.replace(/\bce\s*-?conformity\b/gi, 'CE-Konformität');
}
return raw
.replace(/\bconductor material\b/gi, 'Conductor material')
.replace(/\bconductor class\b/gi, 'Conductor class')
.replace(/\bcore insulation\b/gi, 'Core insulation')
.replace(/\binsulation\b/gi, 'Core insulation')
.replace(/\bfield control\b/gi, 'Field control')
.replace(/\bscreen\b/gi, 'Screen')
.replace(/\blongitudinal water tightness\b/gi, 'Longitudinal water tightness')
.replace(/\btransverse water tightness\b/gi, 'Transverse water tightness')
.replace(/\bsheath material\b/gi, 'Sheath material')
.replace(/\bsheath color\b/gi, 'Sheath color')
.replace(/\bflame retardancy\b/gi, 'Flame retardancy')
.replace(/\buv resistant\b/gi, 'UV resistant')
.replace(/\bmax\.? permissible conductor temperature\b/gi, 'Max. permissible conductor temperature')
.replace(/\bpermissible cable outer temperature, fixed\b/gi, 'Permissible cable outer temperature, fixed')
.replace(/\bpermissible cable outer temperature, in motion\b/gi, 'Permissible cable outer temperature, in motion')
.replace(/\bmaximum short-circuit temperature\b/gi, 'Maximum short-circuit temperature')
.replace(/\bmin\.? bending radius, fixed\b/gi, 'Min. bending radius, fixed')
.replace(/\bminimum laying temperature\b/gi, 'Minimum laying temperature')
.replace(/\bmeter marking\b/gi, 'Meter marking')
.replace(/\bpartial discharge\b/gi, 'Partial discharge')
.replace(/\bcapacitance\b/gi, 'Capacitance')
.replace(/\binductance\b/gi, 'Inductance')
.replace(/\breactance\b/gi, 'Reactance')
.replace(/\btest voltage\b/gi, 'Test voltage')
.replace(/\brated voltage\b/gi, 'Rated voltage')
.replace(/\boperating temperature range\b/gi, 'Operating temperature range')
.replace(/\bminimum sheath thickness\b/gi, 'Sheath thickness (min.)')
.replace(/\bsheath thickness\b/gi, 'Sheath thickness')
.replace(/\bnominal insulation thickness\b/gi, 'Insulation thickness (nom.)')
.replace(/\binsulation thickness\b/gi, 'Insulation thickness')
.replace(/\bdc resistance at 20\s*°?c\b/gi, 'DC resistance (20 °C)')
.replace(/\bouter diameter(?: of cable)?\b/gi, 'Outer diameter')
.replace(/\bbending radius\b/gi, 'Bending radius')
.replace(/\bpackaging\b/gi, 'Packaging')
.replace(/\bce\s*-?conformity\b/gi, 'CE conformity');
}
@@ -253,7 +263,26 @@ function technicalValueTranslation(args: { label: string; value: string; locale:
if (/^stranded$/i.test(v)) return 'mehrdrähtig';
if (/^(\d+)xD$/i.test(v)) return v.replace(/^(\d+)xD$/i, '$1 facher Durchmesser');
if (/^XLPE/i.test(v)) return v.replace(/^XLPE/i, 'VPE');
return v;
if (/^yes, with swelling tape$/i.test(v)) return 'ja, mit Quellvliess';
if (/^yes, Al-tape$/i.test(v)) return 'ja, Al-Band';
if (/^Polyethylene/i.test(v)) return v.replace(/^Polyethylene/i, 'Polyethylen');
if (/^Class 2 stranded$/i.test(v)) return 'Klasse 2 mehrdrähtig';
if (/^VPE DIX8$/i.test(v)) return 'VPE DIX8';
if (/^inner and outer semiconducting layer made of semiconducting plastic - 3-fold extruded$/i.test(v)) return 'innere und äußere Leitschicht aus halbleitendem Kunststoff - 3-fach-extrudiert';
if (/^copper wires \+ transverse conductive helix$/i.test(v)) return 'Kupferdrähte + Querleitwendel';
if (/^Polyethylene DMP2$/i.test(v)) return 'Polyethylen DMP2';
if (/^15 times diameter$/i.test(v)) return '15 facher Durchmesser';
// Fallback for partial matches or common terms
return v
.replace(/\bcopper\b/gi, 'Kupfer')
.replace(/\baluminum\b/gi, 'Aluminium')
.replace(/\bblack\b/gi, 'schwarz')
.replace(/\bstranded\b/gi, 'mehrdrähtig')
.replace(/\byes\b/gi, 'ja')
.replace(/\bno\b/gi, 'nein')
.replace(/\bPolyethylene\b/gi, 'Polyethylen')
.replace(/\bXLPE\b/gi, 'VPE');
}
if (/^ja$/i.test(v)) return 'yes';
@@ -264,7 +293,25 @@ function technicalValueTranslation(args: { label: string; value: string; locale:
if (/^mehrdrähtig$/i.test(v)) return 'stranded';
if (/^(\d+)xD$/i.test(v)) return v.replace(/^(\d+)xD$/i, '$1 times diameter');
if (/^VPE/i.test(v)) return v.replace(/^VPE/i, 'XLPE');
return v;
if (/^ja, mit Quellvliess$/i.test(v)) return 'yes, with swelling tape';
if (/^ja, Al-Band$/i.test(v)) return 'yes, Al-tape';
if (/^Polyethylen/i.test(v)) return v.replace(/^Polyethylen/i, 'Polyethylene');
if (/^Klasse 2 mehrdrähtig$/i.test(v)) return 'Class 2 stranded';
if (/^innere und äußere Leitschicht aus halbleitendem Kunststoff - 3-fach-extrudiert$/i.test(v)) return 'inner and outer semiconducting layer made of semiconducting plastic - 3-fold extruded';
if (/^Kupferdrähte \+ Querleitwendel$/i.test(v)) return 'copper wires + transverse conductive helix';
if (/^Polyethylen DMP2$/i.test(v)) return 'Polyethylene DMP2';
if (/^15 facher Durchmesser$/i.test(v)) return '15 times diameter';
// Fallback for partial matches or common terms
return v
.replace(/\bkupfer\b/gi, 'Copper')
.replace(/\baluminium\b/gi, 'Aluminum')
.replace(/\bschwarz\b/gi, 'black')
.replace(/\bmehrdrähtig\b/gi, 'stranded')
.replace(/\bja\b/gi, 'yes')
.replace(/\bnein\b/gi, 'no')
.replace(/\bPolyethylen\b/gi, 'Polyethylene')
.replace(/\bVPE\b/gi, 'XLPE');
}
function metaFullLabel(args: { key: string; excelKey: string; locale: 'en' | 'de' }): string {
@@ -701,7 +748,7 @@ function buildExcelModel(args: { product: ProductData; locale: 'en' | 'de' }): B
'Mantelmaterial',
'Mantelfarbe',
'Flammwidrigkeit',
'UV-bestandig',
'UV-beständig',
'Max. zulässige Leitertemperatur',
'Zul. Kabelaußentemperatur, fest verlegt',
'Zul. Kabelaußentemperatur, in Bewegung',