Reference documentation and code samples for the Cloud Translation V3 API class Google::Cloud::Translate::V3::TranslationService::Rest::Client.
REST client for the TranslationService service.
Provides natural language translation operations.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the TranslationService Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all TranslationService clients ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.configure do |config| config.timeout = 10.0 end
#adaptive_mt_translate
def adaptive_mt_translate(request, options = nil) -> ::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse
def adaptive_mt_translate(parent: nil, dataset: nil, content: nil, reference_sentence_config: nil, glossary_config: nil) -> ::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse
Translate text using Adaptive MT.
def adaptive_mt_translate(request, options = nil) -> ::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse
adaptive_mt_translate
via a request object, either of type
AdaptiveMtTranslateRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def adaptive_mt_translate(parent: nil, dataset: nil, content: nil, reference_sentence_config: nil, glossary_config: nil) -> ::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse
adaptive_mt_translate
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. Location to make a regional call.
Format:
projects/{project-number-or-id}/locations/{location-id}
. -
dataset (::String) — Required. The resource name for the dataset to use for adaptive MT.
projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}
- content (::Array<::String>) — Required. The content of the input in string format.
- reference_sentence_config (::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::ReferenceSentenceConfig, ::Hash) — Configuration for caller provided reference sentences.
- glossary_config (::Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest::GlossaryConfig, ::Hash) — 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.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::AdaptiveMtTranslateRequest.new # Call the adaptive_mt_translate method. result = client.adaptive_mt_translate request # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtTranslateResponse. p result
#batch_translate_document
def batch_translate_document(request, options = nil) -> ::Gapic::Operation
def batch_translate_document(parent: nil, source_language_code: nil, target_language_codes: nil, input_configs: nil, output_config: nil, models: nil, glossaries: nil, format_conversions: nil, customized_attribution: nil, enable_shadow_removal_native_pdf: nil, enable_rotation_correction: nil) -> ::Gapic::Operation
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.
def batch_translate_document(request, options = nil) -> ::Gapic::Operation
batch_translate_document
via a request object, either of type
BatchTranslateDocumentRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def batch_translate_document(parent: nil, source_language_code: nil, target_language_codes: nil, input_configs: nil, output_config: nil, models: nil, glossaries: nil, format_conversions: nil, customized_attribution: nil, enable_shadow_removal_native_pdf: nil, enable_rotation_correction: nil) -> ::Gapic::Operation
batch_translate_document
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. Location to make a regional call.
Format:
projects/{project-number-or-id}/locations/{location-id}
.The
global
location is not supported for batch translation.Only AutoML Translation models or glossaries within the same region (have the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) error is returned.
- source_language_code (::String) — 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 (::Array<::String>) — Required. The ISO-639 language code to use for translation of the input document. Specify up to 10 language codes here.
- input_configs (::Array<::Google::Cloud::Translate::V3::BatchDocumentInputConfig, ::Hash>) — 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::Translate::V3::BatchDocumentOutputConfig, ::Hash) — 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.
-
models (::Hash{::String => ::String}) — Optional. The models to use for translation. Map's key is target language
code. Map's value is the model name. Value can be a built-in general model,
or an AutoML Translation model.
The value format depends on model type:
AutoML Translation models:
projects/{project-number-or-id}/locations/{location-id}/models/{model-id}
General (built-in) models:
projects/{project-number-or-id}/locations/{location-id}/models/general/nmt
,
If the map is empty or a specific model is not requested for a language pair, then default google model (nmt) is used.
- glossaries (::Hash{::String => ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash}) — Optional. Glossaries to be applied. It's keyed by target language code.
-
format_conversions (::Hash{::String => ::String}) — Optional. The file format conversion map that is applied to all input
files. The map key is the original mime_type. The map value is the target
mime_type of translated documents.
Supported file format conversion includes:
application/pdf
toapplication/vnd.openxmlformats-officedocument.wordprocessingml.document
If nothing specified, output files will be in the same format as the original file.
-
customized_attribution (::String) — Optional. This flag is to support user customized attribution.
If not provided, the default is
Machine Translated by Google
. Customized attribution should follow rules in https://cloud.google.com/translate/attribution#attribution_and_logos - enable_shadow_removal_native_pdf (::Boolean) — Optional. If true, use the text removal server to remove the shadow text on background image for native pdf translation. Shadow removal feature can only be enabled when is_translate_native_pdf_only: false && pdf_native_only: false
- enable_rotation_correction (::Boolean) — Optional. If true, enable auto rotation correction in DVS.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::BatchTranslateDocumentRequest.new # Call the batch_translate_document method. result = client.batch_translate_document request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#batch_translate_text
def batch_translate_text(request, options = nil) -> ::Gapic::Operation
def batch_translate_text(parent: nil, source_language_code: nil, target_language_codes: nil, models: nil, input_configs: nil, output_config: nil, glossaries: nil, labels: nil) -> ::Gapic::Operation
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.
def batch_translate_text(request, options = nil) -> ::Gapic::Operation
batch_translate_text
via a request object, either of type
BatchTranslateTextRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::BatchTranslateTextRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def batch_translate_text(parent: nil, source_language_code: nil, target_language_codes: nil, models: nil, input_configs: nil, output_config: nil, glossaries: nil, labels: nil) -> ::Gapic::Operation
batch_translate_text
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. Location to make a call. Must refer to a caller's project.
Format:
projects/{project-number-or-id}/locations/{location-id}
.The
global
location is not supported for batch translation.Only AutoML Translation models or glossaries within the same region (have the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) error is returned.
- source_language_code (::String) — Required. Source language code.
- target_language_codes (::Array<::String>) — Required. Specify up to 10 language codes here.
-
models (::Hash{::String => ::String}) — Optional. The models to use for translation. Map's key is target language
code. Map's value is model name. Value can be a built-in general model,
or an AutoML Translation model.
The value format depends on model type:
AutoML Translation models:
projects/{project-number-or-id}/locations/{location-id}/models/{model-id}
General (built-in) models:
projects/{project-number-or-id}/locations/{location-id}/models/general/nmt
,
If the map is empty or a specific model is not requested for a language pair, then default google model (nmt) is used.
- input_configs (::Array<::Google::Cloud::Translate::V3::InputConfig, ::Hash>) — Required. Input configurations. The total number of files matched should be <= 100. The total content size should be <= 100M Unicode codepoints. The files must use UTF-8 encoding.
- output_config (::Google::Cloud::Translate::V3::OutputConfig, ::Hash) — 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.
- glossaries (::Hash{::String => ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash}) — Optional. Glossaries to be applied for translation. It's keyed by target language code.
-
labels (::Hash{::String => ::String}) — Optional. The labels with user-defined metadata for the request.
Label keys and values can be no longer than 63 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter.
See https://cloud.google.com/translate/docs/advanced/labels for more information.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::BatchTranslateTextRequest.new # Call the batch_translate_text method. result = client.batch_translate_text request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#configure
def configure() { |config| ... } -> Client::Configuration
Configure the TranslationService Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
#create_adaptive_mt_dataset
def create_adaptive_mt_dataset(request, options = nil) -> ::Google::Cloud::Translate::V3::AdaptiveMtDataset
def create_adaptive_mt_dataset(parent: nil, adaptive_mt_dataset: nil) -> ::Google::Cloud::Translate::V3::AdaptiveMtDataset
Creates an Adaptive MT dataset.
def create_adaptive_mt_dataset(request, options = nil) -> ::Google::Cloud::Translate::V3::AdaptiveMtDataset
create_adaptive_mt_dataset
via a request object, either of type
CreateAdaptiveMtDatasetRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def create_adaptive_mt_dataset(parent: nil, adaptive_mt_dataset: nil) -> ::Google::Cloud::Translate::V3::AdaptiveMtDataset
create_adaptive_mt_dataset
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. Name of the parent project. In form of
projects/{project-number-or-id}/locations/{location-id}
- adaptive_mt_dataset (::Google::Cloud::Translate::V3::AdaptiveMtDataset, ::Hash) — Required. The AdaptiveMtDataset to be created.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Translate::V3::AdaptiveMtDataset)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::CreateAdaptiveMtDatasetRequest.new # Call the create_adaptive_mt_dataset method. result = client.create_adaptive_mt_dataset request # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset. p result
#create_dataset
def create_dataset(request, options = nil) -> ::Gapic::Operation
def create_dataset(parent: nil, dataset: nil) -> ::Gapic::Operation
Creates a Dataset.
def create_dataset(request, options = nil) -> ::Gapic::Operation
create_dataset
via a request object, either of type
CreateDatasetRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::CreateDatasetRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def create_dataset(parent: nil, dataset: nil) -> ::Gapic::Operation
create_dataset
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- parent (::String) — Required. The project name.
- dataset (::Google::Cloud::Translate::V3::Dataset, ::Hash) — Required. The Dataset to create.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::CreateDatasetRequest.new # Call the create_dataset method. result = client.create_dataset request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#create_glossary
def create_glossary(request, options = nil) -> ::Gapic::Operation
def create_glossary(parent: nil, glossary: nil) -> ::Gapic::Operation
Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist.
def create_glossary(request, options = nil) -> ::Gapic::Operation
create_glossary
via a request object, either of type
CreateGlossaryRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::CreateGlossaryRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def create_glossary(parent: nil, glossary: nil) -> ::Gapic::Operation
create_glossary
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- parent (::String) — Required. The project name.
- glossary (::Google::Cloud::Translate::V3::Glossary, ::Hash) — Required. The glossary to create.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::CreateGlossaryRequest.new # Call the create_glossary method. result = client.create_glossary request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#create_glossary_entry
def create_glossary_entry(request, options = nil) -> ::Google::Cloud::Translate::V3::GlossaryEntry
def create_glossary_entry(parent: nil, glossary_entry: nil) -> ::Google::Cloud::Translate::V3::GlossaryEntry
Creates a glossary entry.
def create_glossary_entry(request, options = nil) -> ::Google::Cloud::Translate::V3::GlossaryEntry
create_glossary_entry
via a request object, either of type
CreateGlossaryEntryRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::CreateGlossaryEntryRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def create_glossary_entry(parent: nil, glossary_entry: nil) -> ::Google::Cloud::Translate::V3::GlossaryEntry
create_glossary_entry
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- parent (::String) — Required. The resource name of the glossary to create the entry under.
- glossary_entry (::Google::Cloud::Translate::V3::GlossaryEntry, ::Hash) — Required. The glossary entry to create
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Translate::V3::GlossaryEntry)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::CreateGlossaryEntryRequest.new # Call the create_glossary_entry method. result = client.create_glossary_entry request # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry. p result
#create_model
def create_model(request, options = nil) -> ::Gapic::Operation
def create_model(parent: nil, model: nil) -> ::Gapic::Operation
Creates a Model.
def create_model(request, options = nil) -> ::Gapic::Operation
create_model
via a request object, either of type
CreateModelRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::CreateModelRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def create_model(parent: nil, model: nil) -> ::Gapic::Operation
create_model
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The project name, in form of
projects/{project}/locations/{location}
- model (::Google::Cloud::Translate::V3::Model, ::Hash) — Required. The Model to create.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::CreateModelRequest.new # Call the create_model method. result = client.create_model request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#delete_adaptive_mt_dataset
def delete_adaptive_mt_dataset(request, options = nil) -> ::Google::Protobuf::Empty
def delete_adaptive_mt_dataset(name: nil) -> ::Google::Protobuf::Empty
Deletes an Adaptive MT dataset, including all its entries and associated metadata.
def delete_adaptive_mt_dataset(request, options = nil) -> ::Google::Protobuf::Empty
delete_adaptive_mt_dataset
via a request object, either of type
DeleteAdaptiveMtDatasetRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def delete_adaptive_mt_dataset(name: nil) -> ::Google::Protobuf::Empty
delete_adaptive_mt_dataset
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. Name of the dataset. In the form of
projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Protobuf::Empty)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::DeleteAdaptiveMtDatasetRequest.new # Call the delete_adaptive_mt_dataset method. result = client.delete_adaptive_mt_dataset request # The returned object is of type Google::Protobuf::Empty. p result
#delete_adaptive_mt_file
def delete_adaptive_mt_file(request, options = nil) -> ::Google::Protobuf::Empty
def delete_adaptive_mt_file(name: nil) -> ::Google::Protobuf::Empty
Deletes an AdaptiveMtFile along with its sentences.
def delete_adaptive_mt_file(request, options = nil) -> ::Google::Protobuf::Empty
delete_adaptive_mt_file
via a request object, either of type
DeleteAdaptiveMtFileRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def delete_adaptive_mt_file(name: nil) -> ::Google::Protobuf::Empty
delete_adaptive_mt_file
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. The resource name of the file to delete, in form of
projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Protobuf::Empty)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::DeleteAdaptiveMtFileRequest.new # Call the delete_adaptive_mt_file method. result = client.delete_adaptive_mt_file request # The returned object is of type Google::Protobuf::Empty. p result
#delete_dataset
def delete_dataset(request, options = nil) -> ::Gapic::Operation
def delete_dataset(name: nil) -> ::Gapic::Operation
Deletes a dataset and all of its contents.
def delete_dataset(request, options = nil) -> ::Gapic::Operation
delete_dataset
via a request object, either of type
DeleteDatasetRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::DeleteDatasetRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def delete_dataset(name: nil) -> ::Gapic::Operation
delete_dataset
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- name (::String) — Required. The name of the dataset to delete.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::DeleteDatasetRequest.new # Call the delete_dataset method. result = client.delete_dataset request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#delete_glossary
def delete_glossary(request, options = nil) -> ::Gapic::Operation
def delete_glossary(name: nil) -> ::Gapic::Operation
Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist.
def delete_glossary(request, options = nil) -> ::Gapic::Operation
delete_glossary
via a request object, either of type
DeleteGlossaryRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::DeleteGlossaryRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def delete_glossary(name: nil) -> ::Gapic::Operation
delete_glossary
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- name (::String) — Required. The name of the glossary to delete.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::DeleteGlossaryRequest.new # Call the delete_glossary method. result = client.delete_glossary request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#delete_glossary_entry
def delete_glossary_entry(request, options = nil) -> ::Google::Protobuf::Empty
def delete_glossary_entry(name: nil) -> ::Google::Protobuf::Empty
Deletes a single entry from the glossary
def delete_glossary_entry(request, options = nil) -> ::Google::Protobuf::Empty
delete_glossary_entry
via a request object, either of type
DeleteGlossaryEntryRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def delete_glossary_entry(name: nil) -> ::Google::Protobuf::Empty
delete_glossary_entry
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- name (::String) — Required. The resource name of the glossary entry to delete
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Protobuf::Empty)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::DeleteGlossaryEntryRequest.new # Call the delete_glossary_entry method. result = client.delete_glossary_entry request # The returned object is of type Google::Protobuf::Empty. p result
#delete_model
def delete_model(request, options = nil) -> ::Gapic::Operation
def delete_model(name: nil) -> ::Gapic::Operation
Deletes a model.
def delete_model(request, options = nil) -> ::Gapic::Operation
delete_model
via a request object, either of type
DeleteModelRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::DeleteModelRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def delete_model(name: nil) -> ::Gapic::Operation
delete_model
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- name (::String) — Required. The name of the model to delete.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::DeleteModelRequest.new # Call the delete_model method. result = client.delete_model request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#detect_language
def detect_language(request, options = nil) -> ::Google::Cloud::Translate::V3::DetectLanguageResponse
def detect_language(parent: nil, model: nil, content: nil, mime_type: nil, labels: nil) -> ::Google::Cloud::Translate::V3::DetectLanguageResponse
Detects the language of text within a request.
def detect_language(request, options = nil) -> ::Google::Cloud::Translate::V3::DetectLanguageResponse
detect_language
via a request object, either of type
DetectLanguageRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::DetectLanguageRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def detect_language(parent: nil, model: nil, content: nil, mime_type: nil, labels: nil) -> ::Google::Cloud::Translate::V3::DetectLanguageResponse
detect_language
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. Project or location to make a call. Must refer to a caller's
project.
Format:
projects/{project-number-or-id}/locations/{location-id}
orprojects/{project-number-or-id}
.For global calls, use
projects/{project-number-or-id}/locations/global
orprojects/{project-number-or-id}
.Only models within the same region (has same location-id) can be used. Otherwise an INVALID_ARGUMENT (400) error is returned.
-
model (::String) — Optional. The language detection model to be used.
Format:
projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}
Only one language detection model is currently supported:
projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default
.If not specified, the default model is used.
- content (::String) — The content of the input stored as a string.
- mime_type (::String) — Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html".
-
labels (::Hash{::String => ::String}) — Optional. The labels with user-defined metadata for the request.
Label keys and values can be no longer than 63 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter.
See https://cloud.google.com/translate/docs/advanced/labels for more information.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Translate::V3::DetectLanguageResponse)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::DetectLanguageRequest.new # Call the detect_language method. result = client.detect_language request # The returned object is of type Google::Cloud::Translate::V3::DetectLanguageResponse. p result
#export_data
def export_data(request, options = nil) -> ::Gapic::Operation
def export_data(dataset: nil, output_config: nil) -> ::Gapic::Operation
Exports dataset's data to the provided output location.
def export_data(request, options = nil) -> ::Gapic::Operation
export_data
via a request object, either of type
ExportDataRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::ExportDataRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def export_data(dataset: nil, output_config: nil) -> ::Gapic::Operation
export_data
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
dataset (::String) — Required. Name of the dataset. In form of
projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}
- output_config (::Google::Cloud::Translate::V3::DatasetOutputConfig, ::Hash) — Required. The config for the output content.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::ExportDataRequest.new # Call the export_data method. result = client.export_data request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#get_adaptive_mt_dataset
def get_adaptive_mt_dataset(request, options = nil) -> ::Google::Cloud::Translate::V3::AdaptiveMtDataset
def get_adaptive_mt_dataset(name: nil) -> ::Google::Cloud::Translate::V3::AdaptiveMtDataset
Gets the Adaptive MT dataset.
def get_adaptive_mt_dataset(request, options = nil) -> ::Google::Cloud::Translate::V3::AdaptiveMtDataset
get_adaptive_mt_dataset
via a request object, either of type
GetAdaptiveMtDatasetRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_adaptive_mt_dataset(name: nil) -> ::Google::Cloud::Translate::V3::AdaptiveMtDataset
get_adaptive_mt_dataset
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. Name of the dataset. In the form of
projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Translate::V3::AdaptiveMtDataset)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::GetAdaptiveMtDatasetRequest.new # Call the get_adaptive_mt_dataset method. result = client.get_adaptive_mt_dataset request # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtDataset. p result
#get_adaptive_mt_file
def get_adaptive_mt_file(request, options = nil) -> ::Google::Cloud::Translate::V3::AdaptiveMtFile
def get_adaptive_mt_file(name: nil) -> ::Google::Cloud::Translate::V3::AdaptiveMtFile
Gets and AdaptiveMtFile
def get_adaptive_mt_file(request, options = nil) -> ::Google::Cloud::Translate::V3::AdaptiveMtFile
get_adaptive_mt_file
via a request object, either of type
GetAdaptiveMtFileRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_adaptive_mt_file(name: nil) -> ::Google::Cloud::Translate::V3::AdaptiveMtFile
get_adaptive_mt_file
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. The resource name of the file, in form of
projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Translate::V3::AdaptiveMtFile)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::GetAdaptiveMtFileRequest.new # Call the get_adaptive_mt_file method. result = client.get_adaptive_mt_file request # The returned object is of type Google::Cloud::Translate::V3::AdaptiveMtFile. p result
#get_dataset
def get_dataset(request, options = nil) -> ::Google::Cloud::Translate::V3::Dataset
def get_dataset(name: nil) -> ::Google::Cloud::Translate::V3::Dataset
Gets a Dataset.
def get_dataset(request, options = nil) -> ::Google::Cloud::Translate::V3::Dataset
get_dataset
via a request object, either of type
GetDatasetRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::GetDatasetRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_dataset(name: nil) -> ::Google::Cloud::Translate::V3::Dataset
get_dataset
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- name (::String) — Required. The resource name of the dataset to retrieve.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Translate::V3::Dataset)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::GetDatasetRequest.new # Call the get_dataset method. result = client.get_dataset request # The returned object is of type Google::Cloud::Translate::V3::Dataset. p result
#get_glossary
def get_glossary(request, options = nil) -> ::Google::Cloud::Translate::V3::Glossary
def get_glossary(name: nil) -> ::Google::Cloud::Translate::V3::Glossary
Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist.
def get_glossary(request, options = nil) -> ::Google::Cloud::Translate::V3::Glossary
get_glossary
via a request object, either of type
GetGlossaryRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::GetGlossaryRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_glossary(name: nil) -> ::Google::Cloud::Translate::V3::Glossary
get_glossary
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- name (::String) — Required. The name of the glossary to retrieve.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Translate::V3::Glossary)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::GetGlossaryRequest.new # Call the get_glossary method. result = client.get_glossary request # The returned object is of type Google::Cloud::Translate::V3::Glossary. p result
#get_glossary_entry
def get_glossary_entry(request, options = nil) -> ::Google::Cloud::Translate::V3::GlossaryEntry
def get_glossary_entry(name: nil) -> ::Google::Cloud::Translate::V3::GlossaryEntry
Gets a single glossary entry by the given id.
def get_glossary_entry(request, options = nil) -> ::Google::Cloud::Translate::V3::GlossaryEntry
get_glossary_entry
via a request object, either of type
GetGlossaryEntryRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::GetGlossaryEntryRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_glossary_entry(name: nil) -> ::Google::Cloud::Translate::V3::GlossaryEntry
get_glossary_entry
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- name (::String) — Required. The resource name of the glossary entry to get
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Translate::V3::GlossaryEntry)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::GetGlossaryEntryRequest.new # Call the get_glossary_entry method. result = client.get_glossary_entry request # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry. p result
#get_model
def get_model(request, options = nil) -> ::Google::Cloud::Translate::V3::Model
def get_model(name: nil) -> ::Google::Cloud::Translate::V3::Model
Gets a model.
def get_model(request, options = nil) -> ::Google::Cloud::Translate::V3::Model
get_model
via a request object, either of type
GetModelRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::GetModelRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_model(name: nil) -> ::Google::Cloud::Translate::V3::Model
get_model
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- name (::String) — Required. The resource name of the model to retrieve.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Translate::V3::Model)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::GetModelRequest.new # Call the get_model method. result = client.get_model request # The returned object is of type Google::Cloud::Translate::V3::Model. p result
#get_supported_languages
def get_supported_languages(request, options = nil) -> ::Google::Cloud::Translate::V3::SupportedLanguages
def get_supported_languages(parent: nil, display_language_code: nil, model: nil) -> ::Google::Cloud::Translate::V3::SupportedLanguages
Returns a list of supported languages for translation.
def get_supported_languages(request, options = nil) -> ::Google::Cloud::Translate::V3::SupportedLanguages
get_supported_languages
via a request object, either of type
GetSupportedLanguagesRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::GetSupportedLanguagesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_supported_languages(parent: nil, display_language_code: nil, model: nil) -> ::Google::Cloud::Translate::V3::SupportedLanguages
get_supported_languages
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. Project or location to make a call. Must refer to a caller's
project.
Format:
projects/{project-number-or-id}
orprojects/{project-number-or-id}/locations/{location-id}
.For global calls, use
projects/{project-number-or-id}/locations/global
orprojects/{project-number-or-id}
.Non-global location is required for AutoML models.
Only models within the same region (have same location-id) can be used, otherwise an INVALID_ARGUMENT (400) error is returned.
- display_language_code (::String) — 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.
-
model (::String) — Optional. Get supported languages of this model.
The format depends on model type:
AutoML Translation models:
projects/{project-number-or-id}/locations/{location-id}/models/{model-id}
General (built-in) models:
projects/{project-number-or-id}/locations/{location-id}/models/general/nmt
,
Returns languages supported by the specified model. If missing, we get supported languages of Google general NMT model.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Translate::V3::SupportedLanguages)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::GetSupportedLanguagesRequest.new # Call the get_supported_languages method. result = client.get_supported_languages request # The returned object is of type Google::Cloud::Translate::V3::SupportedLanguages. p result
#iam_policy_client
def iam_policy_client() -> Google::Iam::V1::IAMPolicy::Rest::Client
Get the associated client for mix-in of the IAMPolicy.
- (Google::Iam::V1::IAMPolicy::Rest::Client)
#import_adaptive_mt_file
def import_adaptive_mt_file(request, options = nil) -> ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse
def import_adaptive_mt_file(parent: nil, file_input_source: nil, gcs_input_source: nil) -> ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse
Imports an AdaptiveMtFile and adds all of its sentences into the AdaptiveMtDataset.
def import_adaptive_mt_file(request, options = nil) -> ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse
import_adaptive_mt_file
via a request object, either of type
ImportAdaptiveMtFileRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def import_adaptive_mt_file(parent: nil, file_input_source: nil, gcs_input_source: nil) -> ::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse
import_adaptive_mt_file
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The resource name of the file, in form of
projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}
- file_input_source (::Google::Cloud::Translate::V3::FileInputSource, ::Hash) — Inline file source.
- gcs_input_source (::Google::Cloud::Translate::V3::GcsInputSource, ::Hash) — Google Cloud Storage file source.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::ImportAdaptiveMtFileRequest.new # Call the import_adaptive_mt_file method. result = client.import_adaptive_mt_file request # The returned object is of type Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse. p result
#import_data
def import_data(request, options = nil) -> ::Gapic::Operation
def import_data(dataset: nil, input_config: nil) -> ::Gapic::Operation
Import sentence pairs into translation Dataset.
def import_data(request, options = nil) -> ::Gapic::Operation
import_data
via a request object, either of type
ImportDataRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::ImportDataRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def import_data(dataset: nil, input_config: nil) -> ::Gapic::Operation
import_data
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
dataset (::String) — Required. Name of the dataset. In form of
projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}
- input_config (::Google::Cloud::Translate::V3::DatasetInputConfig, ::Hash) — Required. The config for the input content.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::ImportDataRequest.new # Call the import_data method. result = client.import_data request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#initialize
def initialize() { |config| ... } -> Client
Create a new TranslationService REST client object.
- (config) — Configure the TranslationService client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new do |config| config.timeout = 10.0 end
#list_adaptive_mt_datasets
def list_adaptive_mt_datasets(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>
def list_adaptive_mt_datasets(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>
Lists all Adaptive MT datasets for which the caller has read permission.
def list_adaptive_mt_datasets(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>
list_adaptive_mt_datasets
via a request object, either of type
ListAdaptiveMtDatasetsRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_adaptive_mt_datasets(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>
list_adaptive_mt_datasets
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The resource name of the project from which to list the Adaptive
MT datasets.
projects/{project-number-or-id}/locations/{location-id}
- page_size (::Integer) — Optional. Requested page size. The server may return fewer results than requested. If unspecified, the server picks an appropriate default.
-
page_token (::String) — Optional. A token identifying a page of results the server should return.
Typically, this is the value of
ListAdaptiveMtDatasetsResponse.next_page_token returned from the
previous call to
ListAdaptiveMtDatasets
method. The first page is returned ifpage_token
is empty or missing. - filter (::String) — Optional. An expression for filtering the results of the request. Filter is not supported yet.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtDataset>)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::ListAdaptiveMtDatasetsRequest.new # Call the list_adaptive_mt_datasets method. result = client.list_adaptive_mt_datasets request # The returned object is of type Gapic::PagedEnumerable. You can iterate # over elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtDataset. p item end
#list_adaptive_mt_files
def list_adaptive_mt_files(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>
def list_adaptive_mt_files(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>
Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
def list_adaptive_mt_files(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>
list_adaptive_mt_files
via a request object, either of type
ListAdaptiveMtFilesRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_adaptive_mt_files(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>
list_adaptive_mt_files
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The resource name of the project from which to list the Adaptive
MT files.
projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}
- page_size (::Integer) — Optional.
-
page_token (::String) — Optional. A token identifying a page of results the server should return.
Typically, this is the value of
ListAdaptiveMtFilesResponse.next_page_token returned from the
previous call to
ListAdaptiveMtFiles
method. The first page is returned ifpage_token
is empty or missing.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtFile>)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::ListAdaptiveMtFilesRequest.new # Call the list_adaptive_mt_files method. result = client.list_adaptive_mt_files request # The returned object is of type Gapic::PagedEnumerable. You can iterate # over elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtFile. p item end
#list_adaptive_mt_sentences
def list_adaptive_mt_sentences(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>
def list_adaptive_mt_sentences(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>
Lists all AdaptiveMtSentences under a given file/dataset.
def list_adaptive_mt_sentences(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>
list_adaptive_mt_sentences
via a request object, either of type
ListAdaptiveMtSentencesRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_adaptive_mt_sentences(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>
list_adaptive_mt_sentences
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The resource name of the project from which to list the Adaptive
MT files. The following format lists all sentences under a file.
projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}
The following format lists all sentences within a dataset.projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}
- page_size (::Integer)
-
page_token (::String) — A token identifying a page of results the server should return.
Typically, this is the value of
ListAdaptiveMtSentencesRequest.next_page_token returned from the
previous call to
ListTranslationMemories
method. The first page is returned ifpage_token
is empty or missing.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::AdaptiveMtSentence>)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::ListAdaptiveMtSentencesRequest.new # Call the list_adaptive_mt_sentences method. result = client.list_adaptive_mt_sentences request # The returned object is of type Gapic::PagedEnumerable. You can iterate # over elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::Translate::V3::AdaptiveMtSentence. p item end
#list_datasets
def list_datasets(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Dataset>
def list_datasets(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Dataset>
Lists datasets.
def list_datasets(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Dataset>
list_datasets
via a request object, either of type
ListDatasetsRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::ListDatasetsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_datasets(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Dataset>
list_datasets
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. Name of the parent project. In form of
projects/{project-number-or-id}/locations/{location-id}
- page_size (::Integer) — Optional. Requested page size. The server can return fewer results than requested.
- page_token (::String) — Optional. A token identifying a page of results for the server to return. Typically obtained from next_page_token field in the response of a ListDatasets call.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Dataset>)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Dataset>)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::ListDatasetsRequest.new # Call the list_datasets method. result = client.list_datasets request # The returned object is of type Gapic::PagedEnumerable. You can iterate # over elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::Translate::V3::Dataset. p item end
#list_examples
def list_examples(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Example>
def list_examples(parent: nil, filter: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Example>
Lists sentence pairs in the dataset.
def list_examples(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Example>
list_examples
via a request object, either of type
ListExamplesRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::ListExamplesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_examples(parent: nil, filter: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Example>
list_examples
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. Name of the parent dataset. In form of
projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}
-
filter (::String) —
Optional. An expression for filtering the examples that will be returned. Example filter:
usage=TRAIN
- page_size (::Integer) — Optional. Requested page size. The server can return fewer results than requested.
- page_token (::String) — Optional. A token identifying a page of results for the server to return. Typically obtained from next_page_token field in the response of a ListExamples call.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Example>)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Example>)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::ListExamplesRequest.new # Call the list_examples method. result = client.list_examples request # The returned object is of type Gapic::PagedEnumerable. You can iterate # over elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::Translate::V3::Example. p item end
#list_glossaries
def list_glossaries(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Glossary>
def list_glossaries(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Glossary>
Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist.
def list_glossaries(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Glossary>
list_glossaries
via a request object, either of type
ListGlossariesRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::ListGlossariesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_glossaries(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Glossary>
list_glossaries
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- parent (::String) — Required. The name of the project from which to list all of the glossaries.
- page_size (::Integer) — Optional. Requested page size. The server may return fewer glossaries than requested. If unspecified, the server picks an appropriate default.
-
page_token (::String) — 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
ListGlossaries
method. The first page is returned ifpage_token
is empty or missing. - filter (::String) — 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 will be picked. If missing, no filtering is performed.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Glossary>)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Glossary>)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::ListGlossariesRequest.new # Call the list_glossaries method. result = client.list_glossaries request # The returned object is of type Gapic::PagedEnumerable. You can iterate # over elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::Translate::V3::Glossary. p item end
#list_glossary_entries
def list_glossary_entries(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::GlossaryEntry>
def list_glossary_entries(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::GlossaryEntry>
List the entries for the glossary.
def list_glossary_entries(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::GlossaryEntry>
list_glossary_entries
via a request object, either of type
ListGlossaryEntriesRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::ListGlossaryEntriesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_glossary_entries(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::GlossaryEntry>
list_glossary_entries
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- parent (::String) — Required. The parent glossary resource name for listing the glossary's entries.
- page_size (::Integer) — Optional. Requested page size. The server may return fewer glossary entries than requested. If unspecified, the server picks an appropriate default.
-
page_token (::String) — Optional. A token identifying a page of results the server should return.
Typically, this is the value of
[ListGlossaryEntriesResponse.next_page_token] returned from the previous
call. The first page is returned if
page_token
is empty or missing.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::GlossaryEntry>)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::GlossaryEntry>)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::ListGlossaryEntriesRequest.new # Call the list_glossary_entries method. result = client.list_glossary_entries request # The returned object is of type Gapic::PagedEnumerable. You can iterate # over elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::Translate::V3::GlossaryEntry. p item end
#list_models
def list_models(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Model>
def list_models(parent: nil, filter: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Model>
Lists models.
def list_models(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Model>
list_models
via a request object, either of type
ListModelsRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::ListModelsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_models(parent: nil, filter: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Model>
list_models
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. Name of the parent project. In form of
projects/{project-number-or-id}/locations/{location-id}
-
filter (::String) — Optional. An expression for filtering the models that will be returned.
Supported filter:
dataset_id=${dataset_id}
- page_size (::Integer) — Optional. Requested page size. The server can return fewer results than requested.
- page_token (::String) — Optional. A token identifying a page of results for the server to return. Typically obtained from next_page_token field in the response of a ListModels call.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Model>)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Translate::V3::Model>)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::ListModelsRequest.new # Call the list_models method. result = client.list_models request # The returned object is of type Gapic::PagedEnumerable. You can iterate # over elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::Translate::V3::Model. p item end
#location_client
def location_client() -> Google::Cloud::Location::Locations::Rest::Client
Get the associated client for mix-in of the Locations.
- (Google::Cloud::Location::Locations::Rest::Client)
#operations_client
def operations_client() -> ::Google::Cloud::Translate::V3::TranslationService::Rest::Operations
Get the associated client for long-running operations.
#romanize_text
def romanize_text(request, options = nil) -> ::Google::Cloud::Translate::V3::RomanizeTextResponse
def romanize_text(parent: nil, contents: nil, source_language_code: nil) -> ::Google::Cloud::Translate::V3::RomanizeTextResponse
Romanize input text written in non-Latin scripts to Latin text.
def romanize_text(request, options = nil) -> ::Google::Cloud::Translate::V3::RomanizeTextResponse
romanize_text
via a request object, either of type
RomanizeTextRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::RomanizeTextRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def romanize_text(parent: nil, contents: nil, source_language_code: nil) -> ::Google::Cloud::Translate::V3::RomanizeTextResponse
romanize_text
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. Project or location to make a call. Must refer to a caller's
project.
Format:
projects/{project-number-or-id}/locations/{location-id}
orprojects/{project-number-or-id}
.For global calls, use
projects/{project-number-or-id}/locations/global
orprojects/{project-number-or-id}
. - contents (::Array<::String>) — Required. The content of the input in string format.
- source_language_code (::String) — Optional. The ISO-639 language code of the input text if known, for example, "hi" or "zh". If the source language isn't specified, the API attempts to identify the source language automatically and returns the source language for each content in the response.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Translate::V3::RomanizeTextResponse)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::RomanizeTextRequest.new # Call the romanize_text method. result = client.romanize_text request # The returned object is of type Google::Cloud::Translate::V3::RomanizeTextResponse. p result
#translate_document
def translate_document(request, options = nil) -> ::Google::Cloud::Translate::V3::TranslateDocumentResponse
def translate_document(parent: nil, source_language_code: nil, target_language_code: nil, document_input_config: nil, document_output_config: nil, model: nil, glossary_config: nil, labels: nil, customized_attribution: nil, is_translate_native_pdf_only: nil, enable_shadow_removal_native_pdf: nil, enable_rotation_correction: nil) -> ::Google::Cloud::Translate::V3::TranslateDocumentResponse
Translates documents in synchronous mode.
def translate_document(request, options = nil) -> ::Google::Cloud::Translate::V3::TranslateDocumentResponse
translate_document
via a request object, either of type
Google::Cloud::Translate::V3::TranslateDocumentRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::TranslateDocumentRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def translate_document(parent: nil, source_language_code: nil, target_language_code: nil, document_input_config: nil, document_output_config: nil, model: nil, glossary_config: nil, labels: nil, customized_attribution: nil, is_translate_native_pdf_only: nil, enable_shadow_removal_native_pdf: nil, enable_rotation_correction: nil) -> ::Google::Cloud::Translate::V3::TranslateDocumentResponse
translate_document
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. Location to make a regional call.
Format:
projects/{project-number-or-id}/locations/{location-id}
.For global calls, use
projects/{project-number-or-id}/locations/global
orprojects/{project-number-or-id}
.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 (::String) — 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 (::String) — 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 (::Google::Cloud::Translate::V3::DocumentInputConfig, ::Hash) — Required. Input configurations.
- document_output_config (::Google::Cloud::Translate::V3::DocumentOutputConfig, ::Hash) — Optional. Output configurations. Defines if the output file should be stored within Cloud Storage as well as the desired output format. If not provided the translated file will only be returned through a byte-stream and its output mime type will be the same as the input file's mime type.
-
model (::String) — Optional. The
model
type requested for this translation.The format depends on model type:
AutoML Translation models:
projects/{project-number-or-id}/locations/{location-id}/models/{model-id}
General (built-in) models:
projects/{project-number-or-id}/locations/{location-id}/models/general/nmt
,
If not provided, the default Google model (NMT) will be used for translation.
- glossary_config (::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash) — 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.
-
labels (::Hash{::String => ::String}) — Optional. The labels with user-defined metadata for the request.
Label keys and values can be no longer than 63 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter.
See https://cloud.google.com/translate/docs/advanced/labels for more information.
-
customized_attribution (::String) — Optional. This flag is to support user customized attribution.
If not provided, the default is
Machine Translated by Google
. Customized attribution should follow rules in https://cloud.google.com/translate/attribution#attribution_and_logos - is_translate_native_pdf_only (::Boolean) — Optional. is_translate_native_pdf_only field for external customers. If true, the page limit of online native pdf translation is 300 and only native pdf pages will be translated.
- enable_shadow_removal_native_pdf (::Boolean) — Optional. If true, use the text removal server to remove the shadow text on background image for native pdf translation. Shadow removal feature can only be enabled when is_translate_native_pdf_only: false && pdf_native_only: false
- enable_rotation_correction (::Boolean) — Optional. If true, enable auto rotation correction in DVS.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Translate::V3::TranslateDocumentResponse)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::TranslateDocumentRequest.new # Call the translate_document method. result = client.translate_document request # The returned object is of type Google::Cloud::Translate::V3::TranslateDocumentResponse. p result
#translate_text
def translate_text(request, options = nil) -> ::Google::Cloud::Translate::V3::TranslateTextResponse
def translate_text(contents: nil, mime_type: nil, source_language_code: nil, target_language_code: nil, parent: nil, model: nil, glossary_config: nil, transliteration_config: nil, labels: nil) -> ::Google::Cloud::Translate::V3::TranslateTextResponse
Translates input text and returns translated text.
def translate_text(request, options = nil) -> ::Google::Cloud::Translate::V3::TranslateTextResponse
translate_text
via a request object, either of type
Google::Cloud::Translate::V3::TranslateTextRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::TranslateTextRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def translate_text(contents: nil, mime_type: nil, source_language_code: nil, target_language_code: nil, parent: nil, model: nil, glossary_config: nil, transliteration_config: nil, labels: nil) -> ::Google::Cloud::Translate::V3::TranslateTextResponse
translate_text
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- contents (::Array<::String>) — 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.
- mime_type (::String) — 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 (::String) — 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 (::String) — 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.
-
parent (::String) — Required. Project or location to make a call. Must refer to a caller's
project.
Format:
projects/{project-number-or-id}
orprojects/{project-number-or-id}/locations/{location-id}
.For global calls, use
projects/{project-number-or-id}/locations/global
orprojects/{project-number-or-id}
.Non-global location is required for requests using AutoML models or custom glossaries.
Models and glossaries must be within the same region (have same location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
-
model (::String) — Optional. The
model
type requested for this translation.The format depends on model type:
AutoML Translation models:
projects/{project-number-or-id}/locations/{location-id}/models/{model-id}
General (built-in) models:
projects/{project-number-or-id}/locations/{location-id}/models/general/nmt
,Translation LLM models:
projects/{project-number-or-id}/locations/{location-id}/models/general/translation-llm
,
For global (non-regionalized) requests, use
location-id
global
. For example,projects/{project-number-or-id}/locations/global/models/general/nmt
.If not provided, the default Google model (NMT) will be used
- glossary_config (::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash) — 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.
- transliteration_config (::Google::Cloud::Translate::V3::TransliterationConfig, ::Hash) — Optional. Transliteration to be applied.
-
labels (::Hash{::String => ::String}) — Optional. The labels with user-defined metadata for the request.
Label keys and values can be no longer than 63 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter.
See https://cloud.google.com/translate/docs/advanced/labels for more information.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Translate::V3::TranslateTextResponse)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::TranslateTextRequest.new # Call the translate_text method. result = client.translate_text request # The returned object is of type Google::Cloud::Translate::V3::TranslateTextResponse. p result
#universe_domain
def universe_domain() -> String
The effective universe domain
- (String)
#update_glossary
def update_glossary(request, options = nil) -> ::Gapic::Operation
def update_glossary(glossary: nil, update_mask: nil) -> ::Gapic::Operation
Updates a glossary. A LRO is used since the update can be async if the glossary's entry file is updated.
def update_glossary(request, options = nil) -> ::Gapic::Operation
update_glossary
via a request object, either of type
UpdateGlossaryRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::UpdateGlossaryRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def update_glossary(glossary: nil, update_mask: nil) -> ::Gapic::Operation
update_glossary
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- glossary (::Google::Cloud::Translate::V3::Glossary, ::Hash) — Required. The glossary entry to update.
-
update_mask (::Google::Protobuf::FieldMask, ::Hash) — The list of fields to be updated. Currently only
display_name
and 'input_config'
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::UpdateGlossaryRequest.new # Call the update_glossary method. result = client.update_glossary request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#update_glossary_entry
def update_glossary_entry(request, options = nil) -> ::Google::Cloud::Translate::V3::GlossaryEntry
def update_glossary_entry(glossary_entry: nil) -> ::Google::Cloud::Translate::V3::GlossaryEntry
Updates a glossary entry.
def update_glossary_entry(request, options = nil) -> ::Google::Cloud::Translate::V3::GlossaryEntry
update_glossary_entry
via a request object, either of type
UpdateGlossaryEntryRequest or an equivalent Hash.
- request (::Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def update_glossary_entry(glossary_entry: nil) -> ::Google::Cloud::Translate::V3::GlossaryEntry
update_glossary_entry
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- glossary_entry (::Google::Cloud::Translate::V3::GlossaryEntry, ::Hash) — Required. The glossary entry to update.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Translate::V3::GlossaryEntry)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/translate/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Translate::V3::TranslationService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Translate::V3::UpdateGlossaryEntryRequest.new # Call the update_glossary_entry method. result = client.update_glossary_entry request # The returned object is of type Google::Cloud::Translate::V3::GlossaryEntry. p result