Provides natural language translation operations.
Equality
Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection>
objects compare equal. Objects that compare equal share the same underlying resources.
Performance
Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.
Thread Safety
Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.
Constructors
TranslationServiceClient(TranslationServiceClient const &)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
TranslationServiceClient const &
|
TranslationServiceClient(TranslationServiceClient &&)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
TranslationServiceClient &&
|
TranslationServiceClient(std::shared_ptr< TranslationServiceConnection >, Options)
Parameters | |
---|---|
Name | Description |
connection |
std::shared_ptr< TranslationServiceConnection >
|
opts |
Options
|
Operators
operator=(TranslationServiceClient const &)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
TranslationServiceClient const &
|
Returns | |
---|---|
Type | Description |
TranslationServiceClient & |
operator=(TranslationServiceClient &&)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
TranslationServiceClient &&
|
Returns | |
---|---|
Type | Description |
TranslationServiceClient & |
Functions
TranslateText(std::string const &, std::string const &, std::vector< std::string > const &, Options)
Translates input text and returns translated text.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. Project or location to make a call. Must refer to a caller's project. |
target_language_code |
std::string const &
Required. The ISO-639 language code to use for translation of the input text, set to one of the language codes listed in Language Support. |
contents |
std::vector< std::string > const &
Required. The content of the input in string format. We recommend the total content be less than 30,000 codepoints. The max length of this field is 1024. Use BatchTranslateText for larger text. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::translation::v3::TranslateTextResponse > | the result of the RPC. The response message type (google.cloud.translation.v3.TranslateTextResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
TranslateText(std::string const &, std::string const &, std::string const &, std::string const &, std::string const &, std::vector< std::string > const &, Options)
Translates input text and returns translated text.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. Project or location to make a call. Must refer to a caller's project. |
model |
std::string const &
Optional. The
|
mime_type |
std::string const &
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 |
std::string const &
Optional. The ISO-639 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 |
std::string const &
Required. The ISO-639 language code to use for translation of the input text, set to one of the language codes listed in Language Support. |
contents |
std::vector< std::string > const &
Required. The content of the input in string format. We recommend the total content be less than 30,000 codepoints. The max length of this field is 1024. Use BatchTranslateText for larger text. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::translation::v3::TranslateTextResponse > | the result of the RPC. The response message type (google.cloud.translation.v3.TranslateTextResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
TranslateText(google::cloud::translation::v3::TranslateTextRequest const &, Options)
Translates input text and returns translated text.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::translation::v3::TranslateTextRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::translation::v3::TranslateTextResponse > | the result of the RPC. The response message type (google.cloud.translation.v3.TranslateTextResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
DetectLanguage(std::string const &, std::string const &, std::string const &, std::string const &, Options)
Detects the language of text within a request.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. Project or location to make a call. Must refer to a caller's project. |
model |
std::string const &
Optional. The language detection model to be used. |
mime_type |
std::string const &
Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html". |
content |
std::string const &
The content of the input stored as a string. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::translation::v3::DetectLanguageResponse > | the result of the RPC. The response message type (google.cloud.translation.v3.DetectLanguageResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
DetectLanguage(google::cloud::translation::v3::DetectLanguageRequest const &, Options)
Detects the language of text within a request.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::translation::v3::DetectLanguageRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::translation::v3::DetectLanguageResponse > | the result of the RPC. The response message type (google.cloud.translation.v3.DetectLanguageResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
GetSupportedLanguages(std::string const &, std::string const &, std::string const &, Options)
Returns a list of supported languages for translation.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. Project or location to make a call. Must refer to a caller's project. |
model |
std::string const &
Optional. Get supported languages of this model.
|
display_language_code |
std::string const &
Optional. The language to use to return localized, human readable names of supported languages. If missing, then display names are not returned in a response. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::translation::v3::SupportedLanguages > | the result of the RPC. The response message type (google.cloud.translation.v3.SupportedLanguages) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
GetSupportedLanguages(google::cloud::translation::v3::GetSupportedLanguagesRequest const &, Options)
Returns a list of supported languages for translation.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::translation::v3::GetSupportedLanguagesRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::translation::v3::SupportedLanguages > | the result of the RPC. The response message type (google.cloud.translation.v3.SupportedLanguages) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
TranslateDocument(google::cloud::translation::v3::TranslateDocumentRequest const &, Options)
Translates documents in synchronous mode.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::translation::v3::TranslateDocumentRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::translation::v3::TranslateDocumentResponse > | the result of the RPC. The response message type (google.cloud.translation.v3.TranslateDocumentResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
BatchTranslateText(google::cloud::translation::v3::BatchTranslateTextRequest const &, Options)
Translates a large volume of text in asynchronous batch mode.
This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location.
This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::translation::v3::BatchTranslateTextRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::cloud::translation::v3::BatchTranslateResponse > > | A |
BatchTranslateDocument(std::string const &, std::string const &, std::vector< std::string > const &, std::vector< google::cloud::translation::v3::BatchDocumentInputConfig > const &, google::cloud::translation::v3::BatchDocumentOutputConfig const &, Options)
Translates a large volume of document in asynchronous batch mode.
This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location.
This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. Location to make a regional call. |
source_language_code |
std::string const &
Required. 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. |
target_language_codes |
std::vector< std::string > const &
Required. The ISO-639 language code to use for translation of the input document. Specify up to 10 language codes here. |
input_configs |
std::vector< google::cloud::translation::v3::BatchDocumentInputConfig > const &
Required. Input configurations. The total number of files matched should be <= 100. The total content size to translate should be <= 100M Unicode codepoints. The files must use UTF-8 encoding. |
output_config |
google::cloud::translation::v3::BatchDocumentOutputConfig const &
Required. Output configuration. If 2 input configs match to the same file (that is, same input path), we don't generate output for duplicate inputs. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::cloud::translation::v3::BatchTranslateDocumentResponse > > | A |
BatchTranslateDocument(google::cloud::translation::v3::BatchTranslateDocumentRequest const &, Options)
Translates a large volume of document in asynchronous batch mode.
This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location.
This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::translation::v3::BatchTranslateDocumentRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::cloud::translation::v3::BatchTranslateDocumentResponse > > | A |
CreateGlossary(std::string const &, google::cloud::translation::v3::Glossary const &, Options)
Creates a glossary and returns the long-running operation.
Returns NOT_FOUND, if the project doesn't exist.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. The project name. |
glossary |
google::cloud::translation::v3::Glossary const &
Required. The glossary to create. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::cloud::translation::v3::Glossary > > | A |
CreateGlossary(google::cloud::translation::v3::CreateGlossaryRequest const &, Options)
Creates a glossary and returns the long-running operation.
Returns NOT_FOUND, if the project doesn't exist.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::translation::v3::CreateGlossaryRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::cloud::translation::v3::Glossary > > | A |
ListGlossaries(std::string const &, Options)
Lists glossaries in a project.
Returns NOT_FOUND, if the project doesn't exist.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. The name of the project from which to list all of the glossaries. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::cloud::translation::v3::Glossary > | a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
ListGlossaries(google::cloud::translation::v3::ListGlossariesRequest, Options)
Lists glossaries in a project.
Returns NOT_FOUND, if the project doesn't exist.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::translation::v3::ListGlossariesRequest
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::cloud::translation::v3::Glossary > | a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
GetGlossary(std::string const &, Options)
Gets a glossary.
Returns NOT_FOUND, if the glossary doesn't exist.
Parameters | |
---|---|
Name | Description |
name |
std::string const &
Required. The name of the glossary to retrieve. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::translation::v3::Glossary > | the result of the RPC. The response message type (google.cloud.translation.v3.Glossary) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
GetGlossary(google::cloud::translation::v3::GetGlossaryRequest const &, Options)
Gets a glossary.
Returns NOT_FOUND, if the glossary doesn't exist.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::translation::v3::GetGlossaryRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::translation::v3::Glossary > | the result of the RPC. The response message type (google.cloud.translation.v3.Glossary) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
DeleteGlossary(std::string const &, Options)
Deletes a glossary, or cancels glossary construction if the glossary isn't created yet.
Returns NOT_FOUND, if the glossary doesn't exist.
Parameters | |
---|---|
Name | Description |
name |
std::string const &
Required. The name of the glossary to delete. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::cloud::translation::v3::DeleteGlossaryResponse > > | A |
DeleteGlossary(google::cloud::translation::v3::DeleteGlossaryRequest const &, Options)
Deletes a glossary, or cancels glossary construction if the glossary isn't created yet.
Returns NOT_FOUND, if the glossary doesn't exist.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::translation::v3::DeleteGlossaryRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::cloud::translation::v3::DeleteGlossaryResponse > > | A |