TranslationService
Provides natural language translation operations.
TranslateDocument |
---|
Translates documents in synchronous mode.
|
TranslateDocumentRequest
A document translation request.
Fields | |
---|---|
parent |
Required. Location to make a regional call. Format: For global calls, use Non-global location is required for requests using AutoML models or custom glossaries. Models and glossaries must be within the same region (have the same location-id), otherwise an INVALID_ARGUMENT (400) error is returned. |
source_language_code |
Optional. The ISO-639 language code of the input document 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. Source language must be specified if the request contains a glossary or a custom model. |
target_language_code |
Required. The ISO-639 language code to use for translation of the input document, set to one of the language codes listed in Language Support. |
document_input_config |
Required. Input configurations. |
glossary_config |
Optional. Glossary to be applied. The glossary must be within the same region (have the same location-id) as the model, otherwise an INVALID_ARGUMENT (400) error is returned. Authorization requires the following IAM permission on the specified resource
|
TranslateDocumentResponse
A translated document response message.
Fields | |
---|---|
document_translation |
Translated document. |
glossary_document_translation |
The document's translation output if a glossary is provided in the request. This can be the same as [TranslateDocumentResponse.document_translation] if no glossary terms apply. |
glossary_config |
The |
CreateGlossary |
---|
Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist. |
DeleteGlossary |
---|
Deletes a glossary if the glossary hasn't been created. Returns NOT_FOUND, if the glossary doesn't exist. |
DetectLanguage |
---|
Detects the language of text within a request. |
GetGlossary |
---|
Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist. |
GetSupportedLanguages |
---|
Returns a list of supported languages for translation. |
ListGlossaries |
---|
Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist. |
TranslateText |
---|
Translates input text and returns translated text. |
CreateGlossaryMetadata
Stored in the google.longrunning.Operation.metadata
field returned by CreateGlossary.
Fields | |
---|---|
name |
The name of the glossary that is being created. |
state |
The current state of the glossary creation operation. |
submit_time |
The time when the operation was submitted to the server. |
State
Enumerates the possible states that the creation request can be in.
Enums | |
---|---|
STATE_UNSPECIFIED |
Invalid. |
RUNNING |
Request is being processed. |
SUCCEEDED |
The glossary was successfully created. |
FAILED |
Failed to create the glossary. |
CreateGlossaryRequest
Request message for CreateGlossary.
Fields | |
---|---|
parent |
Required. The project name. |
glossary |
Required. The glossary to create. |
DeleteGlossaryMetadata
Stored in the google.longrunning.Operation.metadata
field returned by DeleteGlossary.
Fields | |
---|---|
name |
The name of the glossary that is being deleted. |
state |
The current state of the glossary deletion operation. |
submit_time |
The time when the operation was submitted to the server. |
State
Enumerates the possible states that the creation request can be in.
Enums | |
---|---|
STATE_UNSPECIFIED |
Invalid. |
RUNNING |
Request is being processed. |
SUCCEEDED |
The glossary was successfully deleted. |
FAILED |
Failed to delete the glossary. |
DeleteGlossaryRequest
Request message for DeleteGlossary.
Fields | |
---|---|
name |
Required. The name of the glossary to delete. |
DeleteGlossaryResponse
Stored in the google.longrunning.Operation.response
field returned by DeleteGlossary.
Fields | |
---|---|
name |
The name of the deleted glossary. |
submit_time |
The time when the operation was submitted to the server. |
end_time |
The time when the glossary deletion is finished and |
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, |
GetGlossaryRequest
Request message for GetGlossary.
Fields | |
---|---|
name |
Required. The name of the glossary to retrieve. |
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. |
Glossary
Represents a glossary built from user provided data.
Fields | |
---|---|
name |
Required. The resource name of the glossary. Glossary names have the form |
input_config |
Required. Provides examples to build the glossary from. Total glossary must not exceed 10M Unicode codepoints. |
entry_count |
Output only. The number of entries defined in the glossary. |
submit_time |
Output only. When CreateGlossary was called. |
end_time |
Output only. When the glossary creation was finished. |
display_name |
Optional. The display name of the glossary. |
Union field languages . Languages supported by the glossary. languages can be only one of the following: |
|
language_pair |
Used with unidirectional glossaries. |
language_codes_set |
Used with equivalent term set glossaries. |
LanguageCodePair
Used with unidirectional glossaries.
Fields | |
---|---|
source_language_code |
Required. The BCP-47 language code of the input text, for example, "en-US". Expected to be an exact match for GlossaryTerm.language_code. |
target_language_code |
Required. The BCP-47 language code for translation output, for example, "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. |
LanguageCodesSet
Used with equivalent term set glossaries.
Fields | |
---|---|
language_codes[] |
The BCP-47 language code(s) for terms defined in the glossary. All entries are unique. The list contains at least two entries. Expected to be an exact match for GlossaryTerm.language_code. |
GlossaryInputConfig
Input configuration for glossaries.
Fields | |
---|---|
s3_source |
Required. Storage location of glossary data. File format is determined based on the filename extension. API returns For unidirectional glossaries:
For equivalent term sets glossaries:
|
ListGlossariesRequest
Request message for ListGlossaries.
Fields | |
---|---|
parent |
Required. The name of the project from which to list all of the glossaries. |
page_size |
Optional. Requested page size. The server may return fewer glossaries than requested. If unspecified, the server picks an appropriate default. |
page_token |
Optional. A token identifying a page of results the server should return. Typically, this is the value of [ListGlossariesResponse.next_page_token] returned from the previous call to |
filter |
Optional. Filter specifying constraints of a list operation. Specify the constraint by the format of "key=value", where key must be "src" or "tgt", and the value must be a valid language code. For multiple restrictions, concatenate them by "AND" (uppercase only), such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used here, which means using 'en-US' and 'en' can lead to different results, which depends on the language code you used when you create the glossary. For the unidirectional glossaries, the "src" and "tgt" add restrictions on the source and target language code separately. For the equivalent term set glossaries, the "src" and/or "tgt" add restrictions on the term set. For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional glossaries which exactly match the source language code as "en-US" and the target language code "zh-CN", but all equivalent term set glossaries which contain "en-US" and "zh-CN" in their language set is picked. If missing, no filtering is performed. |
ListGlossariesResponse
Response message for ListGlossaries.
Fields | |
---|---|
glossaries[] |
The list of glossaries for a project. |
next_page_token |
A token to retrieve a page of results. Pass this value in the [ListGlossariesRequest.page_token] field in the subsequent call to |
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. |
TranslateTextGlossaryConfig
Configures which glossary should be used for a specific target language, and defines options for applying that glossary.
Fields | |
---|---|
glossary |
Required. The The format depends on glossary:
|
ignore_case |
Optional. Indicates match is case-insensitive. Default value is false if missing. |
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. Use BatchTranslateText for larger text. |
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: |
glossary_config |
Optional. Glossary to be applied. |
TranslateTextResponse
Fields | |
---|---|
translations[] |
Text translation responses with no glossary applied. This field has the same length as |
glossary_translations[] |
Text translation responses if a glossary is provided in the request. This can be the same 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. |
glossary_config |
The |