translate()

Overview

public string function translate(
      required string enum        
    , required string key         
    , required string property    
    ,          string defaultValue
    ,          array  data        
)

Translates an enum item property, using any URI template registered for the enum or the default enum.{enum}:{key}.{property} pattern.

Arguments

NameTypeRequiredDescription
enumstringYesID of the enum
keystringYesEnum item key
propertystringYesi18n property, e.g. label, description, iconClass
defaultValuestringNoFallback when the resource is missing. Defaults to the key for `label`, otherwise empty string
dataarrayNoOptional data array passed through to translateResource