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": {
// Includes only one of the fields `glossaryData`
"glossaryData": {
"glossaryPairs": [
{
"sourceText": "string",
"translatedText": "string",
"exact": "boolean"
}
]
}
// end of the list of possible fields
},
"speller": "boolean"
}
Field |
Description |
sourceLanguageCode |
string The text language to translate from. Required for translating with glossary. |
targetLanguageCode |
string Required field. The target language to translate the text. |
format |
enum (Format) Format of the text.
|
texts[] |
string Array of the strings to translate. |
folderId |
string ID of the folder to which you have access. |
model |
string Do not specify this field, custom models are not supported yet. |
glossaryConfig |
Glossary to be applied for the translation. For more information, see Glossaries. |
speller |
boolean use speller |
TranslateGlossaryConfig
Field |
Description |
glossaryData |
Pass glossary data in the request. Currently, only this way to pass glossary is supported. Includes only one of the fields |
GlossaryData
Field |
Description |
glossaryPairs[] |
Array of text pairs. The maximum total length of all source texts is 10000 characters. |
GlossaryPair
Field |
Description |
sourceText |
string Required field. Text in the source language. |
translatedText |
string Required field. Text in the target language. |
exact |
boolean |
Response
HTTP Code: 200 - OK
{
"translations": [
{
"text": "string",
"detectedLanguageCode": "string"
}
]
}
Field |
Description |
translations[] |
Array of the translations. |
TranslatedText
Field |
Description |
text |
string Translated text. |
detectedLanguageCode |
string The language code of the source text. |