Skip to content

Commit 4dbae65

Browse files
authored
Translate palette labels and fallback names via the message catalog (#17)
* Translate palette labels and fallback names via the message catalog Route each node's paletteLabel and the empty-name fallback label through this._() so they resolve from the i18n catalog instead of hard-coded strings. Add paletteLabel and label.fallback keys (en-US + de) per node; the universe fallback interpolates via {{universe}}. * Use Node-RED interpolation syntax for the universe in node labels Node-RED configures i18next with __var__ interpolation delimiters, not the i18next default {{var}}. The universe placeholder in the sacn-in and sacn-out fallback labels therefore rendered literally instead of being substituted.
1 parent 50ab9df commit 4dbae65

18 files changed

Lines changed: 48 additions & 12 deletions

File tree

dist/nodes/sacn-in/locales/de/sacn-in.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"sacn-in": {
3+
"paletteLabel": "sACN Eingang",
34
"label": {
5+
"fallback": "sACN Eingang · U__universe__",
46
"interface": "IP-Adresse des Interfaces",
57
"mode": "Modus",
68
"mode_direct": "Direkt",

dist/nodes/sacn-in/locales/en-US/sacn-in.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"sacn-in": {
3+
"paletteLabel": "sACN in",
34
"label": {
5+
"fallback": "sACN in · U__universe__",
46
"interface": "IP-address of interface",
57
"mode": "mode",
68
"mode_direct": "direct",

dist/nodes/sacn-in/sacn-in.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,12 @@ <h3>References</h3>
268268
},
269269
inputs: 1,
270270
outputs: 1,
271-
paletteLabel: "sACN in",
271+
paletteLabel: function () {
272+
return this._("sacn-in.paletteLabel");
273+
},
272274
icon: "sacn-in.svg",
273275
label: function () {
274-
return this.name || `sACN in · U${this.universe}`;
276+
return this.name || this._("sacn-in.label.fallback", { universe: this.universe });
275277
},
276278
labelStyle: function () {
277279
return this.name ? "node_label_italic" : "";

dist/nodes/sacn-out/locales/de/sacn-out.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"sacn-out": {
3+
"paletteLabel": "sACN Ausgang",
34
"label": {
5+
"fallback": "sACN Ausgang · U__universe__",
46
"interface": "IP-Adresse des Interfaces",
57
"port": "Port",
68
"priority": "Priorität",

dist/nodes/sacn-out/locales/en-US/sacn-out.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"sacn-out": {
3+
"paletteLabel": "sACN out",
34
"label": {
5+
"fallback": "sACN out · U__universe__",
46
"interface": "IP-address of interface",
57
"port": "port",
68
"priority": "priority",

dist/nodes/sacn-out/sacn-out.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,12 @@ <h3>References</h3>
209209
},
210210
inputs: 1,
211211
outputs: 0,
212-
paletteLabel: "sACN out",
212+
paletteLabel: function () {
213+
return this._("sacn-out.paletteLabel");
214+
},
213215
icon: "sacn-out.svg",
214216
label: function () {
215-
return this.name || `sACN out · U${this.universe}`;
217+
return this.name || this._("sacn-out.label.fallback", { universe: this.universe });
216218
},
217219
labelStyle: function () {
218220
return this.name ? "node_label_italic" : "";

dist/nodes/scene-controller/locales/de/scene-controller.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"scene-controller": {
3+
"paletteLabel": "Szenen-Controller",
34
"label": {
5+
"fallback": "Szenen-Controller",
46
"values": "Werte",
57
"values_percent": "Prozent (0–100)",
68
"values_absolute": "Absolut (0–255)"

dist/nodes/scene-controller/locales/en-US/scene-controller.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"scene-controller": {
3+
"paletteLabel": "Scene-Controller",
34
"label": {
5+
"fallback": "Scene-Controller",
46
"values": "values",
57
"values_percent": "percent (0–100)",
68
"values_absolute": "absolute (0–255)"

dist/nodes/scene-controller/scene-controller.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,12 @@ <h3>References</h3>
9494
},
9595
inputs: 1,
9696
outputs: 1,
97-
paletteLabel: "Scene-Controller",
97+
paletteLabel: function () {
98+
return this._("scene-controller.paletteLabel");
99+
},
98100
icon: "scene-controller.svg",
99101
label: function () {
100-
return this.name || "Scene-Controller";
102+
return this.name || this._("scene-controller.label.fallback");
101103
},
102104
labelStyle: function () {
103105
return this.name ? "node_label_italic" : "";

src/nodes/sacn-in/init.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,12 @@ const def: EditorNodeDef<Defaults> = {
118118
},
119119
inputs: 1,
120120
outputs: 1,
121-
paletteLabel: "sACN in",
121+
paletteLabel: function () {
122+
return this._("sacn-in.paletteLabel");
123+
},
122124
icon: "sacn-in.svg",
123125
label: function () {
124-
return this.name || `sACN in · U${this.universe}`;
126+
return this.name || this._("sacn-in.label.fallback", { universe: this.universe });
125127
},
126128
labelStyle: function () {
127129
return this.name ? "node_label_italic" : "";

0 commit comments

Comments
 (0)