Translates input text and returns translated text.
HTTP request
POST https://{TRANSLATION_GDC_ENDPOINT}/v3/{parent}:translateText
Path parameters
Parameters | |
---|---|
parent |
Required. Project to make a call. Must refer to a caller's project. Format: |
Request body
The request body contains data with the following structure:
JSON representation |
---|
{
"contents": [
string
],
"mime_type": string,
"source_language_code": string,
"target_language_code": string,
"glossary_config": {
object |
Fields | |
---|---|
contents[] |
Required. The content of the input in string format. We recommend the total content be less than 30k codepoints. The max length of this field is 1024. |
mime_type |
Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html". |
source_language_code |
Optional. The BCP-47 language code of the input text if known, for example, "en-US" or "sr-Latn". Supported language codes are listed in Language Support. If the source language isn't specified, the API attempts to identify the source language automatically and returns the source language within the response. |
target_language_code |
Required. The BCP-47 language code to use for translation of the input text, set to one of the language codes listed in Language Support. |
glossary_config |
Optional. Glossary to be applied.
|
Response body
If successful, the response body contains an instance of TranslateTextResponse
.