Translations saved via API not showing in Maintenance (DHIS2 2.41.5)

Hi all,

I’m seeing a mismatch between API-stored translations and what the UI displays.

  • DHIS2 version: 2.41.5

  • What I did:

    • PUT to /api/dataElements/fbfJHSPpUQD/translations with: { “translations”: [ { “locale”: “fr”, “property”: “formName”, “value”: “Code de réponse” } ] }

    • Response: 204 No Content

    • Verified with GET /api/dataElements/fbfJHSPpUQD/translations { “translations”: [ { “locale”: “fr”, “property”: “formName”, “value”: “Code de réponse” } ] }

  • UI language set to: French

  • Cleared app cache and hard reloaded the browser

Issue: Despite the translation being present via the API, I don’t see the French “form name” in the Maintenance app (and related Data Entry views). It still shows no french translation label.

Hmm, the one thing I can think of is that you only translated formName. Do you have formName filled in for the English version of the data element? If not, it might default to shortName or Name (I don’t remember which), and you would have to translate those too.

1 Like

Hi @Kenyuri : I think the problem is that you are using formName, but in the translations api, you need to format the property name slightly differently and use FORM_NAME ( Developer Manual - DHIS2 Documentation )

so your example would become:

{ “translations”: [ { “locale”: “fr”, “property”: “FORM_NAME”, “value”: “Code de réponse” } ] }

Remember that when you put this object to the data element’s translations, you will be replacing all existing translations with the payload you are sending, so if you instead want to add a translation, you need to include the existing translations you want to keep in the payload you send.

You can also translate in the UI either from the list view in the maintenance app or by using the translations app.

1 Like