forked from extern/egroupware
allow "{one phrase} {other phrase}" syntax in all attributes marked as translate eg. labels
This commit is contained in:
parent
84e03fe334
commit
52bbfbef0b
@ -209,13 +209,6 @@ var et2_baseWidget = /** @class */ (function (_super) {
|
||||
if (_value == "" && !this._tooltipElem) {
|
||||
return;
|
||||
}
|
||||
// allow statustext to contain multiple translated sub-strings eg: {Firstname}.{Lastname}
|
||||
if (_value.indexOf('{') !== -1) {
|
||||
var egw = this.egw();
|
||||
_value = _value.replace(/{([^}]+)}/g, function (str, p1) {
|
||||
return egw.lang(p1);
|
||||
});
|
||||
}
|
||||
this.statustext = _value;
|
||||
//Get the domnode the tooltip should be attached to
|
||||
var elem = jQuery(this.getTooltipElement());
|
||||
|
@ -282,16 +282,6 @@ export class et2_baseWidget extends et2_DOMWidget implements et2_IAligned
|
||||
return;
|
||||
}
|
||||
|
||||
// allow statustext to contain multiple translated sub-strings eg: {Firstname}.{Lastname}
|
||||
if (_value.indexOf('{') !== -1)
|
||||
{
|
||||
var egw = this.egw();
|
||||
_value = _value.replace(/{([^}]+)}/g, function(str,p1)
|
||||
{
|
||||
return egw.lang(p1);
|
||||
});
|
||||
}
|
||||
|
||||
this.statustext = _value;
|
||||
|
||||
//Get the domnode the tooltip should be attached to
|
||||
|
@ -483,14 +483,28 @@ var et2_widget = /** @class */ (function (_super) {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Translate the attributes
|
||||
for (var key in _attrs) {
|
||||
if (_attrs[key] && typeof this.attributes[key] != "undefined") {
|
||||
if (this.attributes[key].translate === true ||
|
||||
(this.attributes[key].translate === "!no_lang" && !_attrs["no_lang"])) {
|
||||
_attrs[key] = this.egw().lang(_attrs[key]);
|
||||
var _loop_1 = function () {
|
||||
if (_attrs[key] && typeof this_1.attributes[key] != "undefined") {
|
||||
if (this_1.attributes[key].translate === true ||
|
||||
(this_1.attributes[key].translate === "!no_lang" && !_attrs["no_lang"])) {
|
||||
var value = _attrs[key];
|
||||
// allow statustext to contain multiple translated sub-strings eg: {Firstname}.{Lastname}
|
||||
if (value.indexOf('{') !== -1) {
|
||||
var egw_1 = this_1.egw();
|
||||
_attrs[key] = value.replace(/{([^}]+)}/g, function (str, p1) {
|
||||
return egw_1.lang(p1);
|
||||
});
|
||||
}
|
||||
else {
|
||||
_attrs[key] = this_1.egw().lang(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
var this_1 = this;
|
||||
// Translate the attributes
|
||||
for (var key in _attrs) {
|
||||
_loop_1();
|
||||
}
|
||||
};
|
||||
/**
|
||||
|
@ -625,7 +625,20 @@ export class et2_widget extends ClassWithAttributes
|
||||
if (_attrs[key] && typeof this.attributes[key] != "undefined") {
|
||||
if (this.attributes[key].translate === true ||
|
||||
(this.attributes[key].translate === "!no_lang" && !_attrs["no_lang"])) {
|
||||
_attrs[key] = this.egw().lang(_attrs[key]);
|
||||
let value = _attrs[key];
|
||||
// allow statustext to contain multiple translated sub-strings eg: {Firstname}.{Lastname}
|
||||
if (value.indexOf('{') !== -1)
|
||||
{
|
||||
const egw = this.egw();
|
||||
_attrs[key] = value.replace(/{([^}]+)}/g, function(str,p1)
|
||||
{
|
||||
return egw.lang(p1);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
_attrs[key] = this.egw().lang(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user