Machine translates the strings of a branch that have no translation yet, in the languages of the project that are not inactive. It works whether or not automatic translation is switched on, because somebody asks for it.
GET /projects/{projectId}/machine-translation/missing
POST /projects/{projectId}/machine-translation/missingAccess: Session token, or an API key with the translations:write scope. Other keys get 403 with insufficient_scope. The role below still applies to the person the key belongs to.
Role: Project manager (organisation owners and admins are managers of every project).
Path parameters and query #
| Parameter | Description |
|---|---|
projectId | The id of the project. |
branch | The name of the branch, main when left out. In the query of GET, in the query or the JSON body of POST. |
languages | Only these languages, as codes separated by commas or, in the body, as a list. All active languages of the project when left out. A language that is not an active, non-source language of the project, or a value that is not a list of codes, is refused with 422 and fields.languages. |
See what is missing #
GET changes nothing and answers 200:
{ "keys": 12, "translations": 23, "characters": 1840, "provider": "deepl", "running": 0, "unsupported": ["xx"] }| Field | Type | Description |
|---|---|---|
keys | integer | Strings that lack a translation in at least one language. Strings without a source text are left out. |
translations | integer | Translations that are missing and that the service can make, one for each string and language. |
characters | integer | About how many characters would be sent: the source text once for each missing translation. |
provider | string|null | The service that would translate, the one chosen for the project or else the organisation’s default. null when none is connected. |
running | integer | Jobs of this project that have not finished. While there are any, a request to translate is refused. |
unsupported | string[] | Languages the service cannot translate into. They are not in the counts above, and a request to translate leaves them alone. Empty when no service is connected, because nothing is known then. Use another service for these languages, or translate them by hand. |
Translate them #
POST leaves the strings to be translated by the background workers, as drafts flagged as machine translated, and answers 200 at once:
{ "queued": 12, "translations": 23, "characters": 1840, "unsupported": ["xx"] }unsupported is the same as in the answer of GET. The translations appear while the workers get to them, a few at a time and one organisation at a time. Existing translations are never replaced, also not one that somebody saves in the meantime. The characters count towards the monthly limit of the service. The request is recorded in the audit log as mt.autofill.
Errors #
| Status | error | When |
|---|---|---|
| 401 | unauthenticated | The token is missing or not valid. |
| 403 | forbidden | You are not a manager of the project. |
| 404 | not_found | The project or the branch does not exist, or you have no access to it. |
| 422 | invalid_request | languages names a language that is not translated, or is not a list of codes. |
| 409 | mt_not_configured | POST only: no machine translation service is connected. |
| 409 | mt_fill_running | POST only: the strings of this project are already being translated. |
| 409 | project_frozen, branch_frozen | POST only: the project or the branch is frozen. |
| 429 | rate_limited | Too many requests, see Rate limiting. |
See Errors for the error format.