From 365f29f498f1f5245331b8d7bf2eabba6c153659 Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 6 Sep 2022 09:17:12 -0600 Subject: [PATCH] Explicitly translate labels & statustext in nm rows --- .../et2_extension_nextmatch_rowProvider.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/et2_extension_nextmatch_rowProvider.ts b/api/js/etemplate/et2_extension_nextmatch_rowProvider.ts index be3e891164..42570e9a90 100644 --- a/api/js/etemplate/et2_extension_nextmatch_rowProvider.ts +++ b/api/js/etemplate/et2_extension_nextmatch_rowProvider.ts @@ -168,6 +168,7 @@ export class et2_nextmatch_rowProvider { var entry = this._template.seperated.detachable[i]; let widget = entry.widget; + const widget_class = window.customElements.get(widget.localName); // Parse the attribute expressions let data : any = {}; @@ -178,7 +179,7 @@ export class et2_nextmatch_rowProvider data[set.attribute] = mgrs["content"].expandName(set.expression); } // WebComponent IS the node, and we've already cloned it - if(typeof window.customElements.get(widget.localName) != "undefined") + if(typeof widget_class != "undefined") { widget = this._cloneWebComponent(entry, row, data); if(!widget) @@ -217,6 +218,18 @@ export class et2_nextmatch_rowProvider // Adjust data for that row widget.transformAttributes?.call(widget, data); + // Translate + if(widget_class) + { + Object.keys(data).forEach((key) => + { + if(widget_class.translate[key]) + { + data[key] = widget.egw().lang(data[key]); + } + }); + } + // Make sure to only send detached attributes, filter out any deferredProperties let filtered = widget.deferredProperties ? Object.keys(data) .filter(key => attributes.includes(key))