Translate Text (/v1/translate)
Use this endpoint to translate text content from one locale into another.
| POST https://agw.golinguist.com/linguistnow/resources/v1/translate | |||
| Request Headers | |||
| Key | Required | Value | |
| x-api-key | yes | {{your_api_key}} (See Managing your API Key.) | |
| Content-Type | yes | application/json | |
| Request Body (Format: application/json) | |||
| Key | Type | Required | Description |
| rnResponseProjectId | integer | no |
This internally-generated unique numeric identifier is retrieved from a prior translation request response. It represents a translation request session or thread (i.e., a group of translations belonging to the same session, ticket, or chat). Provide the rnResponseProjectId to group this translation with the prior request. |
| sourceContent | string | yes | Content to be translated |
| sourceLocale | string | yes | Locale code of the language to translate from |
| targetLocale | string | yes | Locale code of the language to translate to |
| contentTypeName | string | yes | Content channel Valid value: "api" |
| translationType | string | yes | Type of translation vendor to use Valid values: "machine" |
| textType | string | yes | Type of content that is being translated Valid values: "html", "text" |
| evaluateQuality | boolean | no | Request a Translation Quality Estimate (TQE). Valid values: "true", "false" |
| originalTranslationId | integer | no |
This internally-generated unique numeric identifier is retrieved from a prior translation request response. It represents the original translation. Provide the originalTranslationId to request a retranslation of the original. |
| optimization | boolean | no | Request source content optimization. Valid values: "true", "false" |
| incidentId | string | no | Store a single, CRM-specific, unique identifier for the Incident/Case/Ticket. This allows users to group related translations to an identified session. |
| Request Example | |||
{
"rnResponseProjectId": null,
"sourceContent": "Hello. How may I help you?",
"sourceLocale": "en-us",
"targetLocale": "fr-fr",
"contentTypeName": "api",
"translationType": "machine",
"textType": "html",
"evaluateQuality": "true"
} | |||
| Response Parameters | |||
| Key | Type | Description | |
| belowQualityTarget | string | The Translation Quality Estimate (TQE) result. Valid values: "true", "false" |
|
| rnResponseProjectId | integer | The ID number for the project (See request parameters) |
|
| statusMessage | string | Status message returned from the Translation vendor. (For example, "Machine translation complete") | |
| translatedText | string | The translated content | |
| translationdId | integer | The ID of the translation | |
| wordCount | integer | The number of words that were translated | |
| Response Example (200 OK) | |||
{
"rnResponseProjectId": "123456",
"statusMessage": "Machine translation complete",
"translatedText": "Bonjour. Comment puis-je vous aider ?",
"translationId": 4994,
"wordCount": 6,
"belowQualityTarget": false
} | |||
More on Optional Request Parameters
- Project ID (rnResponseProjectId)
- Translation Quality Estimate (evaluateQuality)
- Original Translation ID ( originalTranslationId)
- Optimization (optimization)
Project ID (rnResponseProjectId)
The Project ID parameter is a great tool to use when you want to associate several translations with each other. A typical scenario would be when you want to count all the translations that occurred for a given chat session or a given ticket. It is not necessary to specify a Project ID for the first translation in a chat session or ticket, but you can reuse the ID generated for this first translation for all subsequent translations that belong with this chat session or ticket.
The other main benefit is performance. Because all translations must carry a rnResponseProjectId, every time you do not specify an ID, some latency occurs as the system generate a new record that houses the rnResponseProjectId. Therefore, specifying an ID means faster processing times.
Translation Quality Estimate (evaluateQuality)
The Translation Quality Estimate (TQE) result is an automated quality assessment given to translation against a predefined quality threshold. To see an example of the feedback that TQE provides agents in Salesforce, see Using the Translation Quality Estimate (TQE). If a translation returns a "belowQualityTarget": true result, you can request a new translation using the originalTranslationId parameter (See next section).
Note that assessing a translation quality estimate may add a small amount of latency to the translation response time. Because of this, this feature is opt-in. Consult with your Customer Success Manager to see if your use case could benefit from TQE.
Original Translation ID (originalTranslationId)
If you are not satisfied with a translation (for example, if the TQE result is below target), you can request a new translation. Check the original translation response and copy the translationId number. Then, recreate your request and add originalTranslationId, with the number that you copied.
For example, in the response above, the translationId is 4994. This means your retranslation request should look like this:
{
"rnResponseProjectId": 123456,
"sourceContent": "Hello. How may I help you?",
"sourceLocale": "en",
"targetLocale": "fr",
"contentTypeName": "api",
"translationType": "machine",
"textType": "html",
"evaluateQuality": "true"
"originalTranslationId": 4994
}
Optimization (optimization)
Optimization of the source content can be useful when you want to ensure the consistency and quality of translations, for example when you have a large pool of agents who may use different styles to address users. Automated optimization can help you use consistent language while saving on training costs.
For the sake of demonstration, suppose that the sourceContent is a flourished "Hello good sir, how may I help you on this glorious day?". This is a style that might not get the best results with machine translation.
Using the optimization: true parameter:
The source is processed before translation so that the text that is actually translated is much more straightforward (lines 2 to 4) and returns an equally straightforward translation (line 9):