Skip to main content

Translations

Translations provide language-specific labels for a class and its fields. Each Translation entry covers one language. Multiple translation entries across classes are merged at runtime.

Definition

{
"language": "en",
"singular": "Employment Agreement",
"plural": "Employment Agreements",
"valueTypeLabels": {
"jobTitle": "Job Title",
"hoursPerWeek": "Hours per Week",
"contractType": "Contract Type"
},
"listValueLabels": {
"my-project.contractType": {
"permanent": "Permanent",
"fixedTerm": "Fixed Term",
"freelance": "Freelance"
}
},
"generalLabels": {
"contractDetails": "Contract Details",
"partiesHeader": "Parties"
}
}
PropertyTypeDescription
languagestringLanguage code (e.g. "en", "nl").
classTypeFQNOptional. When set, this translation applies only to this class scope. Usually omitted, which applies it to the class the translation is defined on.
singularstringSingular class name as shown in the UI.
pluralstringPlural class name as shown in the UI.
valueTypeLabelsobjectLabels for value type fields. Keys are field names.
listValueLabelsobjectLabels for standard list items. Outer key is the list TypeFQN, inner keys are item keys.
generalLabelsobjectFree-form labels for tab titles, section headers, button captions, and static text blocks.

Multiple languages

Define one Translation entry per language. The translations array can contain any number of entries.

"translations": [
{
"language": "en",
"singular": "Employment Agreement",
"plural": "Employment Agreements",
"valueTypeLabels": {
"jobTitle": "Job Title",
"salary": "Monthly Salary"
}
},
{
"language": "nl",
"singular": "Arbeidsovereenkomst",
"plural": "Arbeidsovereenkomsten",
"valueTypeLabels": {
"jobTitle": "Functietitel",
"salary": "Maandsalaris"
}
}
]

Merging across classes

Translations defined on different classes for the same language are merged at runtime. This means a base class can define labels that are overridden or extended by a subclass.

Overriding inherited field labels

A subclass can override the label of any field it inherits — including fields from commons classes. Simply include the field name in valueTypeLabels. The subclass label takes precedence over any label defined higher in the hierarchy.

For example, commons.item defines the name field and commons.dossier defines activeDate (labeled "start date"). A ticket class can relabel both:

{
"class": "my-project.serviceTicket",
"type": "ABSTRACT",
"inherits": "commons.dossier",

"translations": [
{
"language": "en",
"singular": "Service Ticket",
"plural": "Service Tickets",
"valueTypeLabels": {
"subject": "Subject",
"priority": "Priority",
"name": "Ticket reference",
"activeDate": "Opened",
"inactiveDate": "Closed"
}
}
]
}

name, activeDate, and inactiveDate are all inherited from commons classes. Defining them in valueTypeLabels replaces their labels for this class and all its subclasses.

Referencing labels in layouts

Labels in layout items (headers, tab titles, button captions, text blocks) are referenced using LabelKey strings. See Label keys.

A generalLabels entry with key "contractDetails" is referenced in a layout as:

{ "type": "HEADER", "label": "LABEL:contractDetails" }

List value labels

listValueLabels is a nested object. The outer key is the list TypeFQN, the inner keys are the item keys.

"listValueLabels": {
"my-project.contractType": {
"permanent": "Permanent contract",
"fixedTerm": "Fixed-term contract"
}
}

Complete example

{
"class": "my-project.employmentAgreement",
"type": "BASIC",
"inherits": "commons.dossier",

"lists": [
{
"name": "my-project.contractType",
"items": [
{ "key": "permanent" },
{ "key": "fixedTerm" },
{ "key": "freelance" }
]
}
],

"valueTypes": [
{ "name": "jobTitle", "required": true },
{ "name": "salary", "dataType": "CURRENCY" },
{ "name": "contractType", "dataType": "LIST", "list": "my-project.contractType" }
],

"translations": [
{
"language": "en",
"singular": "Employment Agreement",
"plural": "Employment Agreements",
"valueTypeLabels": {
"jobTitle": "Job Title",
"salary": "Monthly Salary",
"contractType": "Contract Type"
},
"listValueLabels": {
"my-project.contractType": {
"permanent": "Permanent",
"fixedTerm": "Fixed Term",
"freelance": "Freelance"
}
},
"generalLabels": {
"contractDetails": "Contract Details"
}
},
{
"language": "nl",
"singular": "Arbeidsovereenkomst",
"plural": "Arbeidsovereenkomsten",
"valueTypeLabels": {
"jobTitle": "Functietitel",
"salary": "Maandsalaris",
"contractType": "Contractvorm"
},
"listValueLabels": {
"my-project.contractType": {
"permanent": "Vast dienstverband",
"fixedTerm": "Tijdelijk contract",
"freelance": "Freelance"
}
},
"generalLabels": {
"contractDetails": "Contractgegevens"
}
}
]
}