Translations (single values)

Write one translation

Write a value for one key in one locale.

PUT
/v1/translations

Write a value for one key in one locale. The value is stored as human_edited, so no translation run overwrites it afterwards. Writing the source locale with a changed value queues a translation run for that key's target locales when automatic translation is on; if AI spend is refused, the write still succeeds.

Send expected_hash to make the write conditional. If the value changed since you read it, the answer is 409 with the current row, and nothing is written.

Authorization

deployToken
headerAuthorizationBearer <token>

A project deploy token, minted in the console under Settings, Developer, API tokens. Send the whole value, including the numeric prefix before the |. A token carries a set of abilities (push, pull, manage, read, write) and each operation requires one of them. Tokens do not inherit from each other: a manage token cannot read the glossary unless it also has read.

Request Body

application/json
  1. body

Send content for a simple key or plural_forms for a plural key. The field is required even when empty: an empty string clears the value, and omitting the field is refused so a request cannot blank a translation by accident.

key*string
Lengthlength <= 500
locale*string
Lengthlength <= 35
content?|
Lengthlength <= 10000
plural_forms?

Values by CLDR plural category.

expected_hash?|

Optional. The content_hash you last read. When it no longer matches, the write is refused with 409 and the current row. null asserts that no value exists yet.

Lengthlength <= 64

Response Body

The row as it stands after the write.

application/json
  1. response
row?

One key, its source value and its value in the requested locale.

curl -X PUT 'https://api.transglot.ai/v1/translations' \  -H 'Content-Type: application/json' \  -d '{  "key": "checkout.submit",  "locale": "fr",  "content": "Payer maintenant",  "expected_hash": "3b5c0f6e1d7a9c2e4f8b0a6d2c4e6f8a1b3d5f7a9c1e3b5d7f9a2c4e6b8d0f1a"}'
{  "row": {    "id": 0,    "name": "string",    "description": "string",    "is_plural": true,    "max_length": 0,    "tags": [      {        "id": 0,        "name": "string"      }    ],    "source_tokens": {      "kind": "simple",      "spans": [        {          "start": 0,          "end": 0,          "kind": "text"        }      ],      "forms": {        "property1": [          {            "start": 0,            "end": 0,            "kind": "text"          }        ],        "property2": [          {            "start": 0,            "end": 0,            "kind": "text"          }        ]      }    },    "source": {      "id": 0,      "content": "string",      "plural_forms": {        "property1": "string",        "property2": "string"      },      "state": "ai_translated",      "stale": true    },    "target": {      "id": 0,      "content": "string",      "plural_forms": {        "property1": "string",        "property2": "string"      },      "state": "ai_translated",      "stale": true,      "content_hash": "string",      "needs_review": true,      "qa_score": 0,      "mqm_score": 0,      "qa_findings": [        {          "category": "string",          "severity": "string",          "message": "string",          "suggestion": "string"        }      ],      "ai_confidence": 0,      "authored_by_you": true    }  }}