diff --git a/api/js/etemplate/Et2Select/Et2Select.ts b/api/js/etemplate/Et2Select/Et2Select.ts index dd420080a8..6af75cb579 100644 --- a/api/js/etemplate/Et2Select/Et2Select.ts +++ b/api/js/etemplate/Et2Select/Et2Select.ts @@ -128,6 +128,19 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect) } } + /** + * List of properties that get translated + * + * @returns object + */ + static get translate() + { + return { + ...super.translate, + emptyLabel: true + } + } + get slots() { return { @@ -332,7 +345,7 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect) return html``; } return html` - ${this.egw().lang(this.emptyLabel)}`; + ${this.emptyLabel}`; } /** diff --git a/api/js/etemplate/Et2Select/Et2WidgetWithSelectMixin.ts b/api/js/etemplate/Et2Select/Et2WidgetWithSelectMixin.ts index 5f4ef994f9..bdc3c39c81 100644 --- a/api/js/etemplate/Et2Select/Et2WidgetWithSelectMixin.ts +++ b/api/js/etemplate/Et2Select/Et2WidgetWithSelectMixin.ts @@ -195,7 +195,7 @@ export const Et2widgetWithSelectMixin = >(supe */ _emptyLabelTemplate() : TemplateResult { - return html`${this.emptyLabel ? this.egw().lang(this.emptyLabel) : ''}`; + return html`${this.emptyLabel}`; } /** diff --git a/api/js/etemplate/Et2Widget/Et2Widget.ts b/api/js/etemplate/Et2Widget/Et2Widget.ts index 7e9f4aa311..286e041d8b 100644 --- a/api/js/etemplate/Et2Widget/Et2Widget.ts +++ b/api/js/etemplate/Et2Widget/Et2Widget.ts @@ -1413,15 +1413,15 @@ function transformAttributes(widget, mgr : et2_arrayMgr, attributes) break; default: attrValue = mgr ? mgr.expandName("" + attrValue) : attrValue; - if(attrValue && typeof attrValue == "string" && !attributes.noLang && widget_class.translate[attribute]) + if(attrValue && typeof attrValue == "string" && widget_class.translate[attribute]) { // allow attribute to contain multiple translated sub-strings eg: {Firstname}.{Lastname} if(attrValue.indexOf('{') !== -1) { - attrValue = attrValue.replace(/{([^}]+)}/g, function(str, p1) + attrValue = attrValue.replace(/{([^}]+)}/g, (str, p1) => { - return this.egw().lang(p1); - }.bind(widget)); + return widget.egw().lang(p1); + }); } else {