Translate API v2, REST: Translation.translate
Translates the text to the specified language.
HTTP request
POST https://translate.api.cloud.yandex.net/translate/v2/translate
Body parameters
{
"sourceLanguageCode": "string",
"targetLanguageCode": "string",
"format": "string",
"texts": [
"string"
],
"folderId": "string",
"model": "string",
"glossaryConfig": {
"glossaryData": {
"glossaryPairs": [
{
"sourceText": "string",
"translatedText": "string",
"exact": true
}
]
}
},
"speller": true
}
Field | Description |
---|---|
sourceLanguageCode | string The text language to translate from. Specified in ISO 639-1 format (for example, Required for translating with glossary. The maximum string length in characters is 3. |
targetLanguageCode | string Required. The target language to translate the text. Specified in ISO 639-1 format (for example, The maximum string length in characters is 3. |
format | string Format of the text.
|
texts[] | string Required. Array of the strings to translate. The maximum total length of all strings is 10000 characters. Must contain at least one element. |
folderId | string ID of the folder to which you have access. Required for authorization with a user account (see UserAccount resource). Don't specify this field if you make the request on behalf of a service account. The maximum string length in characters is 50. |
model | string Do not specify this field, custom models are not supported yet. The maximum string length in characters is 50. |
glossaryConfig | object Glossary to be applied for the translation. For more information, see Glossaries. |
glossaryConfig. glossaryData |
object Pass glossary data in the request. Currently, only this way to pass glossary is supported. |
glossaryConfig. glossaryData. glossaryPairs[] |
object Required. Array of text pairs. The maximum total length of all source texts is 10000 characters. The maximum total length of all translated texts is 10000 characters. The number of elements must be in the range 1-50. |
glossaryConfig. glossaryData. glossaryPairs[]. sourceText |
string Required. Text in the source language. |
glossaryConfig. glossaryData. glossaryPairs[]. translatedText |
string Required. Text in the target language. |
glossaryConfig. glossaryData. glossaryPairs[]. exact |
boolean (boolean) |
speller | boolean (boolean) use speller |
Response
HTTP Code: 200 - OK
{
"translations": [
{
"text": "string",
"detectedLanguageCode": "string"
}
]
}
Field | Description |
---|---|
translations[] | object Array of the translations. |
translations[]. text |
string Translated text. |
translations[]. detectedLanguageCode |
string The language code of the source text. Specified in ISO 639-1 format (for example, |