Translates input text, returning translated text.
HTTP request
POST https://api-gl.lingvanex.com/language/translate/v2
Query parameters
Parameters | |
---|---|
q | string Required The input text to translate. Provide an array of strings to translate multiple phrases. The maximum number of strings is 128. |
target | string Required The language to use for translation of the input text, set to one of the language codes listed in Language Support. |
format | string The format of the source text, in either HTML (default) or plain-text. A value of html indicates HTML and a value of text indicates plain-text. |
source | string The language of the source text, set to one of the language codes listed in Language Support. If the source language is not specified, the API will attempt to detect the source language automatically and return it within the response. |
model | string Not optional, does not affect anything. |
key | string A valid API key to handle requests for this API. |
Response body
If successful, the response body contains data with the following structure:
{
"data": {
object(TranslateTextResponseList)
},
}
Fields | |
---|---|
data | object(TranslateTextResponseList) The list of language translation responses. This list contains a language translation response for each query (q) sent in the language translation request. |
TranslateTextResponseList
A response list contains a list of separate language translation responses.
{
"translations": [
array
],
}
Fields | |
---|---|
translations[] | array (TranslateTextResponseTranslation) Contains list of translation results of the supplied text. |
TranslateTextResponseTranslation
Contains a list of translation results for the requested text.
{
"detectedSourceLanguage": string,
"model": string,
"translatedText": string,
}
Fields | |
---|---|
detectedSourceLanguage | string The source language of the initial request, detected automatically, if no source language was passed within the initial request. If the source language was passed, auto-detection of the language will not occur and this field will be omitted. |
model | string The translation model. Cloud Translation – Basic offers only the nmt Neural Machine Translation (NMT) model. If you did not include a model parameter with your request, then this field is not included in the response. |
translatedText | string Text translated into the target language. |