diff --git a/src/style_manager/model/Property.js b/src/style_manager/model/Property.js index ed66704e3..9ade14085 100644 --- a/src/style_manager/model/Property.js +++ b/src/style_manager/model/Property.js @@ -67,10 +67,15 @@ export default class Property extends Model { /** * Get property label. + * @param {Object} [opts={}] Options + * @param {Boolean} [opts.locale=true] Use the locale string from i18n module * @returns {String} */ - getLabel() { - return this.get('name'); + getLabel(opts = {}) { + const { locale = true } = opts; + const id = this.getId(); + const name = this.get('name'); + return (locale && this.em?.t(`styleManager.properties.${id}`)) || name; } /** diff --git a/src/style_manager/view/PropertyView.js b/src/style_manager/view/PropertyView.js index 560d97bcd..0a0f20be9 100644 --- a/src/style_manager/view/PropertyView.js +++ b/src/style_manager/view/PropertyView.js @@ -16,10 +16,10 @@ export default Backbone.View.extend({ }, templateLabel(model) { - const { pfx, em } = this; + const { pfx } = this; const { parent } = model; - const { icon = '', info = '', id, name } = model.attributes; - const label = (em && em.t(`styleManager.properties.${id}`)) || name; + const { icon = '', info = '' } = model.attributes; + const label = model.getLabel(); return `