1.51 Translations

DHIS2 allows for translations of database content. You can work with translations through the Web API using the translations resource.

/api/26/translations

1.51.1 Create translation

You can create a translation with a POST request in JSON format:

{
  "objectId": "P3jJH5Tu5VC",
  "className": "DataElement",
  "locale": "es",
  "property": "name",
  "value": "Casos de fiebre amarilla"
}

POST /api/26/translations

The properties which support translations are listed in the table below.

Property names
Property name Description
name Object name
shortName Object short name
description Object description

The classes which support translations are listed in the table below.

Class names
Class name Description
DataElementCategoryOption Category option
DataElementCategory Category
DataElementCategoryCombo Category combination
DataElement Data element
DataElementGroup Data element group
DataElementGroupSet Data element group set
Indicator Indicator
IndicatorType Indicator type
IndicatorGroup Indicator group
IndicatorGroupSet Indicator group set
OrganisationUnit Organisation unit
OrganisationUnitGroup Organisation unit group
OrganisationUnitGroupSet Organisation unit group set
DataSet Data set
Section Data set section
ValidationRule Validation rule
ValidationRuleGroup Validation rule group
Program Program
ProgramStage Program stage
TrackedEntityAttribute Tracked entity attribute
TrackedEntity Tracked entity
RelationshipType Relationship type for tracked entity instances
OptionSet Option set
Attribute Attribute for metadata

1.51.2 Get translations

You can browse all translations through the translations resource:

GET /api/26/translations

You can use the standard filtering technique to fetch translations of interest. E.g. to get all translations for data elements in the Spanish locale you can use this request:

/api/26/translations.json?fields=*&filter=className:eq:DataElement&filter=locale:eq:es

To get translations for a specific object for all properties:

/api/26/translations.json?fields=*&filter=className:eq:DataElement&filter=locale:eq:fr&filter=objectId:eq:fbfJHSPpUQD