Skip to content

EspoCRM – Open Source CRM Application

translate options use null coalesce

Yurii1aabf6eea6b1
diff --git a/client/src/language.js b/client/src/language.js
index 6728ff4fdc..a6d4fcad88 100644
--- a/client/src/language.js
+++ b/client/src/language.js
@@ -139,13 +139,9 @@ class Language {
* @returns {string}
*/
translateOption(value, field, scope) {
- let translation = this.translate(field, 'options', scope);
+ const map = this.translate(field, 'options', scope) ?? {};
- if (typeof translation !== 'object') {
- translation = {};
- }
-
- return translation[value] || value;
+ return map[value] || value;
}
/**