translate options use null coalesce
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user