Translates input text, returning translated text.
Arguments
Parameters | |
---|---|
format |
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.
|
key |
A valid API key to handle requests for this API. If you are using OAuth 2.0 service account credentials (recommended), do not supply this parameter.
|
model |
The
|
q |
Required. The input text to translate. Repeat this parameter to perform translation operations on multiple text inputs.
|
source |
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 identify the source language automatically and return it within the response.
|
target |
Required. The language to use for translation of the input text, set to one of the language codes listed in Language Support.
|
Raised exceptions
Exceptions | |
---|---|
ConnectionError |
In case of a network problem (such as DNS failure or refused connection). |
HttpError |
If the response status is >= 400 (excluding 429 and 503). |
TimeoutError |
If a long-running operation takes longer to finish than the specified timeout limit. |
TypeError |
If an operation or function receives an argument of the wrong type. |
ValueError |
If an operation or function receives an argument of the right type but an inappropriate value. For example, a negative timeout. |
Response
If successful, the response contains an instance of TranslationsListResponse
.
Subworkflow snippet
Some fields might be optional or required. To identify required fields, refer to the API documentation.
YAML
- translate: call: googleapis.translate.v2.translations.translate args: format: ... key: ... model: ... q: ... source: ... target: ... result: translateResult
JSON
[ { "translate": { "call": "googleapis.translate.v2.translations.translate", "args": { "format": "...", "key": "...", "model": "...", "q": "...", "source": "...", "target": "..." }, "result": "translateResult" } } ]