Translations

The Translations API provides endpoints for translating plain text or entity fields into any supported language. These endpoints are typically used to automate or assist with content localization throughout the application.

Translate Text

Translate an array of text strings into a target language.

Definition

POST /api/translations/translate-text

Request Keys

Key
Type
Default
Description

target_lang_id *

string

-

The ID of the target Language.

text *

array

-

Array of strings to translate (up to 50 per request).

is_html

boolean

false

If true, the text is treated as HTML and tags are preserved.

Keys with * are required.

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/translations/translate-text', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'target_lang_id' => 'fr-FR',
        'text' => [
            'Hello world!',
            'This is a test.',
            '<strong>Bold text</strong>'
        ],
        'is_html' => true
    ]
]);

Example Response

{
  "status": "success",
  "data": {
    "text": [
      "Bonjour à tous !",
      "Il s'agit d'un test.",
      "<strong>Texte en gras</strong>"
    ]
  }
}

Translate Entities

Translate fields of one or more entities into a target language.

Definition

POST /api/translations/translate-entities

Request Keys

Key
Type
Default
Description

target_lang_id *

string

-

The ID of the target Language.

translatables *

array

-

Array of objects describing the entities and fields to translate.

translatables.*.translatable_type *

string

-

The entity type (e.g. infoboardPost).

translatables.*.translatable_id *

integer

-

The ID of the entity to translate.

translatables.*.translatable_fields

array

All fields

Array of field names to translate (if omitted, all translatable fields are used).

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/translations/translate-entities', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'target_lang_id' => 'es-ES',
        'translatables' => [
            [
                'translatable_type' => 'infoboardPost',
                'translatable_id' => 10
            ]
        ]
    ]
]);

Example Response

{
  "status": "success",
  "data": [
    {
      "id": 1,
      "user_id": 2,
      "lang_id": "es-ES",
      "translatable_type": "infoboardPost",
      "translatable_id": 10,
      "translatable_field": "title",
      "translatable_field_value": "¡Por fin abierto de nuevo!",
      "created_at": "2025-05-15 12:00:00",
      "updated_at": "2025-05-15 12:00:00",
      "deleted_at": null
    },
    {
      "id": 2,
      "user_id": 2,
      "lang_id": "es-ES",
      "translatable_type": "infoboardPost",
      "translatable_id": 10,
      "translatable_field": "text",
      "translatable_field_value": "<p>Por fin han concluido las obras de remodelación de nuestra sucursal: ¡a partir de la semana que viene volveremos a abrir en Limburgo!</p><p></p><p>Como de costumbre, encontrará la rotación actual en su carpeta de archivos.</p>",
      "created_at": "2025-05-15 12:00:00",
      "updated_at": "2025-05-15 12:00:00",
      "deleted_at": null
    }
  ]
}

Last updated