Main menu

Add a new translation in a given locale

POST https://localise.biz/api/translations/{id}/{locale} 

Translates a single asset in a single locale in the currently authenticated project.

If the asset is already translated, a new revision will be added and the revision field incremented.

If the asset is untranslated the locale must have already been added to the project.

URI parameters

id

Asset ID

string required
locale

Locale short code, or language tag

string required
key

API key - required if not sent in Authorization header

string optional

Request body

The POST request body must contain (string) Raw value of new translation. Sending empty marks as 'untranslated'.

Loco's official SDK binds the request body to the "data" parameter. Check the documentation for other libraries.

Request headers

Authorization

API key sent as "Loco <key>" or "Basic <encoded>". See Authentication.

string required if not in query

Response

A single JSON-encoded Translation object, which takes the following form:

{
    "id": "", // Unique asset ID for which this is a translation
    "status": "", // Status of translation as string compatible with export status parameter
    "flagged": false, // Whether translation is flagged as requiring attention
    "translated": false, // Whether the translation exists (even if flagged)
    "translation": "", // Translated text in specified locale
    "revision": 0, // Number of edits made, zero if never translated
    "comments": 0, // Number of comments available
    "modified": "", // Time last modified in UTC, null if translation doesn't exist
    "author": {
        "id": 0, // User id
        "name": "", // Full user name
        "email": "", // Contact email address if you have permission to see it
    },
    "flagger": {
        "id": 0, // User id
        "name": "", // Full user name
        "email": "", // Contact email address if you have permission to see it
    },
    "locale": {
        "code": "", // Locale short code, or language tag
        "name": "", // Friendly display name
        "source": false, // Whether the default/source locale of the project
        "plurals": {
            "length": 2, // Number of forms including singular
            "equation": "n != 1", // Equation for calculating offset in forms
            "forms": ["zero","one","two","few","many","other"], // Plural form names
        },
        "progress": {
            "translated": 0, // Number of assets for which a translation exists (including those flagged)
            "untranslated": 0, // Number of assets that are not yet translated to this language
            "flagged": 0, // Number of translations that are flagged as requiring attention
            "words": 0, // Approximate word count for translated texts in this language
        }
    },
    "plurals": [
        {
            "id": "", // Asset ID
            "status": "", // Status of translation as string compatible with export status parameter
            "flagged": false, // Whether translation is flagged as requiring attention
            "translated": false, // Whether asset is translated and contributing to project completion
            "translation": "", // Translated text in specified locale
            "revision": 0, // Number of edits made, zero if never translated
            "comments": 0, // Number of comments available
            "modified": "", // Time last modified in UTC, null if translation doesn't exist
            "author": {
                "id": 0, // User id
                "name": "", // Full user name
                "email": "", // Contact email address if you have permission to see it
            },
            "flagger": {
                "id": 0, // User id
                "name": "", // Full user name
                "email": "", // Contact email address if you have permission to see it
            }
        }
    ]
}  

Try it

Open in test console »


« /api/translations