Label

Syntax

$object.label("de")
label($object, "de")
$object.label()
label($object)

Label

The label for the object in the requested language. The label is usually the name of the object. Uses the "Label Provider Service" to generate the label. That means in particular, no automatic translation is performed.

If no language is specified, the language in which the script is executed is used. If a language which is not supported is specified, the result is unspecified.

Parameter

Name Type Description Mandatory Default
object Any The object for which the label should be fetched. Everything that can be processed by the "Label Provider Service" can be passed. What that includes and excludes depends on the configuration of that service in the particular application. yes
lang String or 'Locale' The language for which the label should be returned. Both ISO 639-1 codes and 'Locale' objects can be used. no The default is the language in which the script is executed. In general, that is the language of the user for whom the script is executed. If, on the other side, the script is not executed for a user but for example in a background task, the language of the application is used.

Return Value

Type: String

Examples

$myProject.label("de") // "Brot backen"
$myProject.label("en") // "Bake bread"
$myProject.label("eo") // Undefined, as Esperanto is not supported.