TranslationService
Provides natural language translation operations.
DetectLanguage |
---|
Detects the language of text within a request. |
GetSupportedLanguages |
---|
Returns a list of supported languages for translation. |
TranslateText |
---|
Translates input text and returns translated text. |
DetectLanguageRequest
The request message for language detection.
Fields | |
---|---|
parent |
Required. Project to make a call. Must refer to a caller's project. Format: |
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". |
content |
The content of the input stored as a string. |
DetectLanguageResponse
The response message for language detection.
Fields | |
---|---|
languages[] |
The most probable language detected by the Translation API. For each request, the Translation API will always return only one result. |
DetectedLanguage
The response message for language detection.
Fields | |
---|---|
language_code |
The BCP-47 language code of source content in the request, detected automatically. |
confidence |
The confidence of the detection result for this language. |
S3Source
The storage location for the input content.
Fields | |
---|---|
input_uri |
Required. Source data URI. For example, |
GetSupportedLanguagesRequest
The request message for discovering supported languages.
Fields | |
---|---|
parent |
Required. Project to make a call. Must refer to a caller's project. Format: |
display_language_code |
Optional. The language to use to return localized, human-readable names of supported languages. If missing, then display names aren't returned in a response. |
SupportedLanguage
A single supported language response corresponds to information related to one supported language.
Fields | |
---|---|
language_code |
Supported language code, generally consisting of its ISO 639-1 identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes including language and region identifiers are returned (for example, 'zh-TW' and 'zh-CN') |
display_name |
Human-readable name of the language localized in the display language specified in the request. |
support_source |
Can be used as source language. |
support_target |
Can be used as target language. |
SupportedLanguages
The response message for discovering supported languages.
Fields | |
---|---|
languages[] |
A list of supported language responses. This list contains an entry for each language the Translation API supports. |
TranslateTextRequest
The request message for synchronous translation.
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 |
The BCP-47 language code of the input text if known, for example, |
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. |
parent |
Required. Project to make a call. Must refer to a caller's project. Format: |
TranslateTextResponse
Fields | |
---|---|
translations[] |
Text translation responses. This field has the same length as |
Translation
A single translation response.
Fields | |
---|---|
translated_text |
Text translated into the target language. If an error occurs during translation, this field might be excluded from the response. |
detected_language_code |
If the source language was passed, auto-detection of the language doesn't occur and this field is empty. |