fix translate option

This commit is contained in:
Yuri Kuznetsov
2022-07-03 12:54:11 +03:00
parent 572aceb107
commit dda1b4e547
3 changed files with 17 additions and 10 deletions
+4
View File
@@ -389,6 +389,10 @@ function (marked, DOMPurify, /** typeof Handlebars */Handlebars) {
}
}
if (name === null) {
name = '';
}
return translationHash[name] || name;
});
+6 -3
View File
@@ -79,11 +79,14 @@ function (Dep, Selectize, _) {
}
}
let translationKey = value || '';
if (
typeof value !== 'undefined' && value !== null && value !== ''
typeof value !== 'undefined' && value !== null && value !== ''
||
value === '' && (
value in (this.translatedOptions || {}) && (this.translatedOptions || {})[value] !== ''
translationKey === '' && (
translationKey in (this.translatedOptions || {}) &&
(this.translatedOptions || {})[translationKey] !== ''
)
) {
data.isNotEmpty = true;
+7 -7
View File
@@ -26,14 +26,15 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/preferences/fields/theme', 'views/fields/enum', function (Dep) {
define('views/preferences/fields/theme', ['views/fields/enum'], function (Dep) {
return Dep.extend({
setup: function () {
this.params.options = Object.keys(this.getMetadata().get('themes')).sort(function (v1, v2) {
return this.translate(v1, 'themes').localeCompare(this.translate(v2, 'themes'));
}.bind(this));
this.params.options = Object.keys(this.getMetadata().get('themes'))
.sort((v1, v2) => {
return this.translate(v1, 'themes').localeCompare(this.translate(v2, 'themes'));
});
this.params.options.unshift('');
@@ -41,11 +42,10 @@ Espo.define('views/preferences/fields/theme', 'views/fields/enum', function (Dep
this.translatedOptions = this.translatedOptions || {};
var defaultTranslated = this.translatedOptions[this.getConfig().get('theme')] || this.getConfig().get('theme');
var defaultTranslated = this.translatedOptions[this.getConfig().get('theme')] ||
this.getConfig().get('theme');
this.translatedOptions[''] = this.translate('Default') + ' (' + defaultTranslated + ')';
},
});
});