Translate
Functions to translate text from one language to another
GET /translate
Translate text from one language to another.
Parameters
- async (optional) - Enables or disables asynchronous mode. When enabled, this will return a job identifier immediately while the request is being processed - it is the clients responsibility to check back with the
jobs
endpoint at a later time to see if the request has been completed, and to collect the results. When disabled, the request will block until completed, and the results ready to return to the client. - request (required) - JSON containing the translation request with the following parameters:
Attribute (* = required) | Description |
---|---|
metric | If defined, the metric used when automatically proposing a vendor:ACCURACY - the vendor with the highest accuracy metrics is proposed (e.g. best quality)SPEED - highest speed is proposed (e.g. quicker)COST - lowest cost is proposed (e.g. least expensive) |
provider * | The name of a configuration vendor adapter to be used for the translation, or AUTO to get an automatic proposal of the best vendor for the specified metric . |
sourceLanguage * | Language code of the source text. |
targetLanguage * | Language code of the target language. |
text | Text to translate as one block of text. |
texts | Text to translate as an array of sentences. |
Note that at least one of text
and texts
must be specified for a translation to be done.
The following is a sample request
:
{
"provider": "AWS",
"sourceLanguage": "en-GB",
"targetLanguage": "fr-FR",
"texts": [
"This is my example text."
]
}
Response
The following is a sample response:
{
"id": "60ec4dc1345f3c0d38079d99",
"ownerId": "c09d9c91-1d2a-4818-9713-b99b1d179f74",
"provider": "AWS",
"autoProvider": false,
"service": "TRANSLATE",
"status": "DONE",
"created": "2021-07-12T14:12:17.972+0000",
"started": "2021-07-12T14:12:17.972+0000",
"finished": "2021-07-12T14:12:18.120+0000",
"estimatedProgress": 100,
"fromLang": "en",
"texts": [
"This is my example text."
],
"toLang": "fr",
"translatedTexts": [
"Voici mon exemple de texte."
]
}
GET /translate/pairs
Returns the supported language translation pairs for one or all providers.
Parameters
- languages (optional) - A comma separated list of languages to be used as a filter for the source part of the language pair
- provider (optional) - Return the supported language pairs from a single named provider
Response
The response is given by provider, then source language, with an array of all the target languages this can be translated to. The following is a sample response:
{
"AZURE": {
"en": [
"af",
"am",
"ar",
"as",
"az",
"bg",
"bn",
"bs",
...
GET /translate/providers
Returns a list of all supported vendor adapters that can respond to a translation request.
Parameters
None
Response
Below is a sample response:
[
"AZURE",
"DEEPL",
"AWS",
"GOOGLE",
"MARIAN"
]