Haiilo API: Import translations

If you want to add several translations at once, it’s possible to do this with our REST API interface. 
 
Note:
Pleas execute these API steps always as super admin.

Step 1: Find out which languages are activated

Execute this GET command to find out which languages are activated and can be translated by you:
GET /web/i18n/bundles/<bundle>/available-languages
Frontend or backend can be stated as <bundle>
 
This is what your result looks like if you’ve activated German, English, and Dutch:
 
Content-Type: application/json
[
"de",
"en",
"nl"
]

Optional step: activate additional language

If you want to translate an additional language, you can do this with this PUT command and body content:
PUT /api/languages/<language>

Body:

Content-Type: application/json
{
"active":true
}
Use the corresponding abbreviation for the desired language in lowercase letters for <language> (e.g. de, en).

Step 2: Add your own translation (if there isn’t a translation yet)

Execute this POST command including body to import a new translation:
POST /web/i18n/overrides/<language>/translations/<languagekey>

Body:

Content-Type: application/json
{
"value":"<translation>",
"bundle":"<bundle>"
}

Note that the placeholders need to be filled accordingly:

  • the corresponding abbreviation for the desired language in lowercase letters for <language> (e.g. de, en)
  • the key that you want to customize for <languagekey>
  • the new translation for <translation>
  • "frontend" or "backend" for <bundle>

Step 3: Add your own translation (if there’s already a translation)

Execute this PUT command including body to customize an existing translation:
PUT /web/i18n/overrides/<language>/translations/<languagekey>
Content-Type: application/json
{
"value":"<translation>",
"bundle":"<bundle>"
}

Note that the placeholders need to be filled accordingly:

  • the corresponding abbreviation for the desired language in lowercase letters for <language> (e.g. de, en)
  • the key that you want to customize for <languagekey> and
  • the new translation for <translation>
  • "frontend" or "backend" for <bundle> 

Step 4: Delete own translation

Execute this DELETE command to delete an existing translation: 
DELETE /web/i18n/overrides/<language>/translations/<bundle>/<key>
Here, too, the placeholders <language> and <languagekey> should be filled with whatever you want to delete.

Step 5: Display own translation

Execute this GET command to see existing translations:
GET /web/i18n/overrides/public/<language>/translations
Use the corresponding abbreviation for the desired language in lowercase letters for <language> (e.g. de, en).
 
Note:
This command only gives you completed translations.

Was this article helpful?