translate options use null coalesce
This commit is contained in:
@@ -139,13 +139,9 @@ class Language {
|
|||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
translateOption(value, field, scope) {
|
translateOption(value, field, scope) {
|
||||||
let translation = this.translate(field, 'options', scope);
|
const map = this.translate(field, 'options', scope) ?? {};
|
||||||
|
|
||||||
if (typeof translation !== 'object') {
|
return map[value] || value;
|
||||||
translation = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
return translation[value] || value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user