Skip to content

Commit 5d35235

Browse files
committed
chore: Add translations
1 parent b552a71 commit 5d35235

File tree

4 files changed

+35
-9
lines changed

4 files changed

+35
-9
lines changed

packages/compas-open-scd/src/translations/de.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,18 @@ export const de: Translations = {
537537
scaleMultiplierHelper: '???',
538538
scaleOffsetHelper: '???',
539539
},
540+
export: {
541+
noSignalsFound: 'Export 104 hat keine Signale gefunden',
542+
invalidSignalWarning: 'Export 104 hat ein ungültiges Signal gefunden',
543+
errors: {
544+
tiOrIoaInvalid: 'ti or ioa fehlen oder ioa hat weniger als 4 Zeichen, ti: "{{ ti }}", ioa: "{{ ioa }}"',
545+
unknownSignalType: 'Unbekannter Signaltyp für ti: "{{ ti }}", ioa: "{{ ioa }}"',
546+
noDoi: 'Es wurde kein Eltern DOI Element gefunden für ioa: "{{ ioa }}"',
547+
noBay: 'Es wurde kein Bay Element mit dem Namen "{{ bayName }}" für ioa: "{{ ioa }}" gefunden',
548+
noVoltageLevel: 'Es wurde kein VoltageLevel Element für Bay "{{ bayName }}" gefunden für ioa "{{ ioa }}"',
549+
noSubstation: 'Es wurde kein Substation Element gefunden für VoltageLevel "{{ voltageLevelName }}" für ioa "{{ ioa }}"'
550+
}
551+
}
540552
},
541553
'compare-ied': {
542554
selectProjectTitle: 'Lade IEDs aus Vorlage',

packages/compas-open-scd/src/translations/en.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,18 @@ export const en = {
536536
scaleMultiplierHelper: 'Scale Multiplier',
537537
scaleOffsetHelper: 'Scale Offset',
538538
},
539+
export: {
540+
noSignalsFound: 'Export 104 found no signals',
541+
invalidSignalWarning: 'Export 104 found invalid signal',
542+
errors: {
543+
tiOrIoaInvalid: 'ti or ioa are missing or ioa is less than 4 digits, ti: "{{ ti }}", ioa: "{{ ioa }}"',
544+
unknownSignalType: 'Unknown signal type for ti: "{{ ti }}", ioa: "{{ ioa }}"',
545+
noDoi: 'No parent DOI found for address with ioa: "{{ ioa }}"',
546+
noBay: 'No Bay found bayname: "{{ bayName }}" for address with ioa: "{{ ioa }}"',
547+
noVoltageLevel: 'No parent voltage level found for bay "{{ bayName }}" for ioa "{{ ioa }}"',
548+
noSubstation: 'No parent substation found for voltage level "{{ voltageLevelName }}" for ioa "{{ ioa }}"'
549+
}
550+
}
539551
},
540552
'compare-ied': {
541553
selectProjectTitle: 'Select template project to Compare IED with',

packages/plugins/src/menu/Export104.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { stringify } from 'csv-stringify/browser/esm/sync';
33
import { newLogEvent } from '@openscd/core/foundation/deprecated/history.js';
44

55
import { extractAllSignal104Data, Signal104 } from './export104/foundation.js';
6+
import { get } from 'lit-translate';
67

78

89

@@ -26,7 +27,7 @@ export default class Export104 extends LitElement {
2627
if (signals.length === 0) {
2728
this.dispatchEvent(newLogEvent({
2829
kind: 'info',
29-
title: 'Export 104 found no signals',
30+
title: get('protocol104.export.noSignalsFound'),
3031
}));
3132
return;
3233
}
@@ -47,7 +48,7 @@ export default class Export104 extends LitElement {
4748
private logWarning(errorMessage: string): void {
4849
this.dispatchEvent(newLogEvent({
4950
kind: 'warning',
50-
title: 'Export 104 found invalid signal',
51+
title: get('protocol104.export.invalidSignalWarning'),
5152
message: errorMessage,
5253
}));
5354
}

packages/plugins/src/menu/export104/foundation.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// TODO: Share with 104 editor plugin?
1+
import { get } from "lit-translate";
2+
23
export const PROTOCOL_104_PRIVATE = 'IEC_60870_5_104';
34

45
export interface Signal104 {
@@ -46,21 +47,21 @@ function extractSignal104Data(addressElement: Element, doc: XMLDocument): Extrac
4647

4748
// By convention the last four digits of the ioa are the signalnumber, see https://github.com/com-pas/compas-open-scd/issues/334
4849
if (ti === null || ioa === null || ioa.length < 4) {
49-
return { signal: null, error: `ti or ioa are missing or ioa is less than 4 digits, ti: ${ti}, ioa: ${ioa}` };
50+
return { signal: null, error: get('protocol104.export.errors.tiOrIoaInvalid', { ti: ti ?? '', ioa: ioa ?? '' }) };
5051
}
5152
const { signalNumber, bayName } = splitIoa(ioa);
5253

5354
const signalType = getSignalType(ti);
5455
if (signalType === SignalType.Unknown) {
55-
return { signal: null, error: `Unknown signal type for ti: ${ti}, ioa: ${ioa}` };
56+
return { signal: null, error: get('protocol104.export.errors.unknownSignalType', { ti: ti ?? '', ioa: ioa ?? '' }) };
5657
}
5758
const isMonitorSignal = signalType === SignalType.Monitor;
5859

5960
addressElement.parentElement;
6061
const parentDOI = addressElement.closest('DOI');
6162

6263
if (!parentDOI) {
63-
return { signal: null, error: `No parent DOI found for address with ioa: ${ioa}` };
64+
return { signal: null, error: get('protocol104.export.errors.noDoi', { ioa: ioa ?? '' }) };
6465
}
6566

6667
const doiDesc = parentDOI.getAttribute('desc');
@@ -69,20 +70,20 @@ function extractSignal104Data(addressElement: Element, doc: XMLDocument): Extrac
6970
const parentBay = doc.querySelector(parentBayQuery);
7071

7172
if (!parentBay) {
72-
return { signal: null, error: `No bay found with bayname: ${bayName} for ioa ${ioa}` };
73+
return { signal: null, error: get('protocol104.export.errors.noBay', { bayName, ioa: ioa ?? '' }) };
7374
}
7475

7576
const parentVoltageLevel = parentBay.closest('VoltageLevel');
7677

7778
if (!parentVoltageLevel) {
78-
return { signal: null, error: `No parent voltage level found for bay ${bayName} for ioa ${ioa}` };
79+
return { signal: null, error: get('protocol104.export.errors.noVoltageLevel', { bayName, ioa: ioa ?? '' }) };
7980
}
8081

8182
const voltageLevelName = parentVoltageLevel.getAttribute('name');
8283
const parentSubstation = parentVoltageLevel.closest('Substation');
8384

8485
if (!parentSubstation) {
85-
return { signal: null, error: `No parent substation found for voltage level ${voltageLevelName} for ioa ${ioa}` };
86+
return { signal: null, error: get('protocol104.export.errors.noSubstation', { voltageLevelName: voltageLevelName ?? '', ioa: ioa ?? '' }) };
8687
}
8788

8889
const substationName = parentSubstation.getAttribute('name');

0 commit comments

Comments
 (0)