mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 00:54:50 +01:00
noLang only affects options, label, statustext, placeholder, emptyLabel get always translated
This commit is contained in:
parent
aa80b4027a
commit
dee28cb53f
@ -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()
|
get slots()
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
@ -332,7 +345,7 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
|
|||||||
return html``;
|
return html``;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<sl-menu-item value="">${this.egw().lang(this.emptyLabel)}</sl-menu-item>`;
|
<sl-menu-item value="">${this.emptyLabel}</sl-menu-item>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -195,7 +195,7 @@ export const Et2widgetWithSelectMixin = <T extends Constructor<LitElement>>(supe
|
|||||||
*/
|
*/
|
||||||
_emptyLabelTemplate() : TemplateResult
|
_emptyLabelTemplate() : TemplateResult
|
||||||
{
|
{
|
||||||
return html`${this.emptyLabel ? this.egw().lang(this.emptyLabel) : ''}`;
|
return html`${this.emptyLabel}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1413,15 +1413,15 @@ function transformAttributes(widget, mgr : et2_arrayMgr, attributes)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
attrValue = mgr ? mgr.expandName("" + attrValue) : attrValue;
|
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}
|
// allow attribute to contain multiple translated sub-strings eg: {Firstname}.{Lastname}
|
||||||
if(attrValue.indexOf('{') !== -1)
|
if(attrValue.indexOf('{') !== -1)
|
||||||
{
|
{
|
||||||
attrValue = attrValue.replace(/{([^}]+)}/g, function(str, p1)
|
attrValue = attrValue.replace(/{([^}]+)}/g, (str, p1) =>
|
||||||
{
|
{
|
||||||
return this.egw().lang(p1);
|
return widget.egw().lang(p1);
|
||||||
}.bind(widget));
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user