Package google.cloud.translate.v2

Index

TranslateService

Provides language translation operations.

DetectLanguage

rpc DetectLanguage(DetectLanguageRequest) returns (DetectLanguageResponse)

Detects the language of text within a request.

Authorization scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-translation
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

GetSupportedLanguages

rpc GetSupportedLanguages(GetSupportedLanguagesRequest) returns (GetSupportedLanguagesResponse)

Returns a list of supported languages for translation.

Authorization scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-translation
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

TranslateText

rpc TranslateText(TranslateTextRequest) returns (TranslateTextResponse)

Translates input text, returning translated text.

Authorization scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-translation
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

DetectLanguageRequest

The request message for language detection.

Fields
q[]

string

The input text upon which to perform language detection. Repeat this parameter to perform language detection on multiple text inputs.

DetectLanguageResponse

The response message for language detection.

Fields
data

DetectLanguageResponseList

The list of language detection responses. This list will contain a language detection response for each query (q) sent in the language detection request.

DetectLanguageResponseList

A response list contains a list of separate language detection responses.

Fields
detections[]

ListValue

Language detection results for each input text piece. For backward compatibility, this list must be expressed as an array of arrays, which requires using ListValue in proto3.

Example: "detections": [ [{ "language": "en", "isReliable": false, "confidence": 0.9882 }], [{ "language": "pl", "isReliable": false, "confidence": 0.5683 }] ]

GetSupportedLanguagesRequest

The request message for discovering supported languages.

Fields
target

string

The language to use to return localized, human readable names of supported languages.

model

string

The model type for which supported languages should be returned. Refer to the Cloud Translation API documentation for a list of language pairs that are supported for a given model value.

GetSupportedLanguagesResponse

The response message for discovering supported languages.

Fields
data

GetSupportedLanguagesResponseList

A list of supported language responses. This list will contain an entry for each language supported by the Translation API.

GetSupportedLanguagesResponseLanguage

A single supported language response corresponds to information related to one supported language.

Fields
language

string

Supported language code, generally consisting of its ISO 639-1 identifier. (E.g. 'en', 'ja'). In certain cases, BCP-47 codes including language + region identifiers are returned (e.g. 'zh-TW' and 'zh-CH')

name

string

Human readable name of the language localized to the target language.

GetSupportedLanguagesResponseList

A response list contains a list of separate supported language responses.

Fields
languages[]

GetSupportedLanguagesResponseLanguage

The set of supported languages.

TranslateTextRequest

The main translation request message for the Cloud Translation API.

Fields
q[]

string

The input text to translate. Provide an array of strings to translate multiple phrases. The maximum number of strings is 128.

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 identify the source language automatically and return it within the response.

target

string

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.

model

string

The model type requested for this translation. Valid values are listed in public documentation.

TranslateTextResponse

The main language translation response message.

Fields
data

TranslateTextResponseList

A list of translation text responses. This list will contain a translation response for each query (q) sent in the request.

TranslateTextResponseList

A response list contains a list of separate translation responses.

Fields
translations[]

TranslateTextResponseTranslation

The text translated into the target language.

TranslateTextResponseTranslation

A single translation response corresponds to translation of one query (q) from a translation request.

Fields
translated_text

string

Text translated into the target language.

detected_source_language

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 empty.

model

string

The model type used for this translation. Valid values are listed in public documentation. Can be different from requested model. Present only if specific model type was explicitly requested.