google-cloud-translate-v3 0.3.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/google/cloud/translate/v3/translation_service/client.rb +296 -11
- data/lib/google/cloud/translate/v3/translation_service_pb.rb +99 -0
- data/lib/google/cloud/translate/v3/translation_service_services_pb.rb +11 -2
- data/lib/google/cloud/translate/v3/version.rb +1 -1
- data/proto_docs/google/cloud/translate/v3/translation_service.rb +559 -25
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8cfa4d08984860e5959afa7256f8f0f080f06ab005fa1d4b9d0faf0c8eb4bf1
|
4
|
+
data.tar.gz: 352e5dca02bf816caa32be3aef72876ccbc730e5169bc4eb6927b8631421c911
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 488a8eb67f8215a8bdc46951ae63c0b0af83bcdfefde0125e3fcb7806c6208a50b85b9008c50a149a6737b8c6631102ee5bf61c2cb5e80341470c7ebca0657bf
|
7
|
+
data.tar.gz: ff5fab29974c8902d18bc8a17b5438fa4b098bfccb6b73eab04ae72ac2c62327ec5c208641908d6a8b03a630071238887afdd89008f77627f52f515071de573d
|
@@ -73,8 +73,12 @@ module Google
|
|
73
73
|
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
74
74
|
}
|
75
75
|
|
76
|
+
default_config.rpcs.translate_document.timeout = 600.0
|
77
|
+
|
76
78
|
default_config.rpcs.batch_translate_text.timeout = 600.0
|
77
79
|
|
80
|
+
default_config.rpcs.batch_translate_document.timeout = 600.0
|
81
|
+
|
78
82
|
default_config.rpcs.create_glossary.timeout = 600.0
|
79
83
|
|
80
84
|
default_config.rpcs.list_glossaries.timeout = 600.0
|
@@ -204,7 +208,8 @@ module Google
|
|
204
208
|
#
|
205
209
|
# @param contents [::Array<::String>]
|
206
210
|
# Required. The content of the input in string format.
|
207
|
-
# We recommend the total content be less than 30k codepoints.
|
211
|
+
# We recommend the total content be less than 30k codepoints. The max length
|
212
|
+
# of this field is 1024.
|
208
213
|
# Use BatchTranslateText for larger text.
|
209
214
|
# @param mime_type [::String]
|
210
215
|
# Optional. The format of the source text, for example, "text/html",
|
@@ -243,14 +248,13 @@ module Google
|
|
243
248
|
#
|
244
249
|
# - General (built-in) models:
|
245
250
|
# `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
|
246
|
-
# `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
|
247
251
|
#
|
248
252
|
#
|
249
253
|
# For global (non-regionalized) requests, use `location-id` `global`.
|
250
254
|
# For example,
|
251
255
|
# `projects/{project-number-or-id}/locations/global/models/general/nmt`.
|
252
256
|
#
|
253
|
-
# If
|
257
|
+
# If not provided, the default Google model (NMT) will be used.
|
254
258
|
# @param glossary_config [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash]
|
255
259
|
# Optional. Glossary to be applied. The glossary must be
|
256
260
|
# within the same region (have the same location-id) as the model, otherwise
|
@@ -263,7 +267,8 @@ module Google
|
|
263
267
|
# characters, underscores and dashes. International characters are allowed.
|
264
268
|
# Label values are optional. Label keys must start with a letter.
|
265
269
|
#
|
266
|
-
# See https://cloud.google.com/translate/docs/labels for more
|
270
|
+
# See https://cloud.google.com/translate/docs/advanced/labels for more
|
271
|
+
# information.
|
267
272
|
#
|
268
273
|
# @yield [response, operation] Access the result along with the RPC operation
|
269
274
|
# @yieldparam response [::Google::Cloud::Translate::V3::TranslateTextResponse]
|
@@ -365,7 +370,8 @@ module Google
|
|
365
370
|
# characters, underscores and dashes. International characters are allowed.
|
366
371
|
# Label values are optional. Label keys must start with a letter.
|
367
372
|
#
|
368
|
-
# See https://cloud.google.com/translate/docs/labels for more
|
373
|
+
# See https://cloud.google.com/translate/docs/advanced/labels for more
|
374
|
+
# information.
|
369
375
|
#
|
370
376
|
# @yield [response, operation] Access the result along with the RPC operation
|
371
377
|
# @yieldparam response [::Google::Cloud::Translate::V3::DetectLanguageResponse]
|
@@ -460,11 +466,10 @@ module Google
|
|
460
466
|
#
|
461
467
|
# - General (built-in) models:
|
462
468
|
# `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
|
463
|
-
# `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
|
464
469
|
#
|
465
470
|
#
|
466
471
|
# Returns languages supported by the specified model.
|
467
|
-
# If missing, we get supported languages of Google general
|
472
|
+
# If missing, we get supported languages of Google general NMT model.
|
468
473
|
#
|
469
474
|
# @yield [response, operation] Access the result along with the RPC operation
|
470
475
|
# @yieldparam response [::Google::Cloud::Translate::V3::SupportedLanguages]
|
@@ -513,6 +518,131 @@ module Google
|
|
513
518
|
raise ::Google::Cloud::Error.from_error(e)
|
514
519
|
end
|
515
520
|
|
521
|
+
##
|
522
|
+
# Translates documents in synchronous mode.
|
523
|
+
#
|
524
|
+
# @overload translate_document(request, options = nil)
|
525
|
+
# Pass arguments to `translate_document` via a request object, either of type
|
526
|
+
# {::Google::Cloud::Translate::V3::TranslateDocumentRequest} or an equivalent Hash.
|
527
|
+
#
|
528
|
+
# @param request [::Google::Cloud::Translate::V3::TranslateDocumentRequest, ::Hash]
|
529
|
+
# A request object representing the call parameters. Required. To specify no
|
530
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
531
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
532
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
533
|
+
#
|
534
|
+
# @overload 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)
|
535
|
+
# Pass arguments to `translate_document` via keyword arguments. Note that at
|
536
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
537
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
538
|
+
#
|
539
|
+
# @param parent [::String]
|
540
|
+
# Required. Location to make a regional call.
|
541
|
+
#
|
542
|
+
# Format: `projects/{project-number-or-id}/locations/{location-id}`.
|
543
|
+
#
|
544
|
+
# For global calls, use `projects/{project-number-or-id}/locations/global` or
|
545
|
+
# `projects/{project-number-or-id}`.
|
546
|
+
#
|
547
|
+
# Non-global location is required for requests using AutoML models or custom
|
548
|
+
# glossaries.
|
549
|
+
#
|
550
|
+
# Models and glossaries must be within the same region (have the same
|
551
|
+
# location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
|
552
|
+
# @param source_language_code [::String]
|
553
|
+
# Optional. The BCP-47 language code of the input document if known, for
|
554
|
+
# example, "en-US" or "sr-Latn". Supported language codes are listed in
|
555
|
+
# Language Support. If the source language isn't specified, the API attempts
|
556
|
+
# to identify the source language automatically and returns the source
|
557
|
+
# language within the response. Source language must be specified if the
|
558
|
+
# request contains a glossary or a custom model.
|
559
|
+
# @param target_language_code [::String]
|
560
|
+
# Required. The BCP-47 language code to use for translation of the input
|
561
|
+
# document, set to one of the language codes listed in Language Support.
|
562
|
+
# @param document_input_config [::Google::Cloud::Translate::V3::DocumentInputConfig, ::Hash]
|
563
|
+
# Required. Input configurations.
|
564
|
+
# @param document_output_config [::Google::Cloud::Translate::V3::DocumentOutputConfig, ::Hash]
|
565
|
+
# Optional. Output configurations.
|
566
|
+
# Defines if the output file should be stored within Cloud Storage as well
|
567
|
+
# as the desired output format. If not provided the translated file will
|
568
|
+
# only be returned through a byte-stream and its output mime type will be
|
569
|
+
# the same as the input file's mime type.
|
570
|
+
# @param model [::String]
|
571
|
+
# Optional. The `model` type requested for this translation.
|
572
|
+
#
|
573
|
+
# The format depends on model type:
|
574
|
+
#
|
575
|
+
# - AutoML Translation models:
|
576
|
+
# `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
|
577
|
+
#
|
578
|
+
# - General (built-in) models:
|
579
|
+
# `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
|
580
|
+
#
|
581
|
+
#
|
582
|
+
# If not provided, the default Google model (NMT) will be used for
|
583
|
+
# translation.
|
584
|
+
# @param glossary_config [::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash]
|
585
|
+
# Optional. Glossary to be applied. The glossary must be within the same
|
586
|
+
# region (have the same location-id) as the model, otherwise an
|
587
|
+
# INVALID_ARGUMENT (400) error is returned.
|
588
|
+
# @param labels [::Hash{::String => ::String}]
|
589
|
+
# Optional. The labels with user-defined metadata for the request.
|
590
|
+
#
|
591
|
+
# Label keys and values can be no longer than 63 characters (Unicode
|
592
|
+
# codepoints), can only contain lowercase letters, numeric characters,
|
593
|
+
# underscores and dashes. International characters are allowed. Label values
|
594
|
+
# are optional. Label keys must start with a letter.
|
595
|
+
#
|
596
|
+
# See https://cloud.google.com/translate/docs/advanced/labels for more
|
597
|
+
# information.
|
598
|
+
#
|
599
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
600
|
+
# @yieldparam response [::Google::Cloud::Translate::V3::TranslateDocumentResponse]
|
601
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
602
|
+
#
|
603
|
+
# @return [::Google::Cloud::Translate::V3::TranslateDocumentResponse]
|
604
|
+
#
|
605
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
606
|
+
#
|
607
|
+
def translate_document request, options = nil
|
608
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
609
|
+
|
610
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::TranslateDocumentRequest
|
611
|
+
|
612
|
+
# Converts hash and nil to an options object
|
613
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
614
|
+
|
615
|
+
# Customize the options with defaults
|
616
|
+
metadata = @config.rpcs.translate_document.metadata.to_h
|
617
|
+
|
618
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
619
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
620
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
621
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
622
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
623
|
+
|
624
|
+
header_params = {
|
625
|
+
"parent" => request.parent
|
626
|
+
}
|
627
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
628
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
629
|
+
|
630
|
+
options.apply_defaults timeout: @config.rpcs.translate_document.timeout,
|
631
|
+
metadata: metadata,
|
632
|
+
retry_policy: @config.rpcs.translate_document.retry_policy
|
633
|
+
|
634
|
+
options.apply_defaults timeout: @config.timeout,
|
635
|
+
metadata: @config.metadata,
|
636
|
+
retry_policy: @config.retry_policy
|
637
|
+
|
638
|
+
@translation_service_stub.call_rpc :translate_document, request, options: options do |response, operation|
|
639
|
+
yield response, operation if block_given?
|
640
|
+
return response
|
641
|
+
end
|
642
|
+
rescue ::GRPC::BadStatus => e
|
643
|
+
raise ::Google::Cloud::Error.from_error(e)
|
644
|
+
end
|
645
|
+
|
516
646
|
##
|
517
647
|
# Translates a large volume of text in asynchronous batch mode.
|
518
648
|
# This function provides real-time output as the inputs are being processed.
|
@@ -563,14 +693,13 @@ module Google
|
|
563
693
|
#
|
564
694
|
# - General (built-in) models:
|
565
695
|
# `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
|
566
|
-
# `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
|
567
696
|
#
|
568
697
|
#
|
569
698
|
# If the map is empty or a specific model is
|
570
699
|
# not requested for a language pair, then default google model (nmt) is used.
|
571
700
|
# @param input_configs [::Array<::Google::Cloud::Translate::V3::InputConfig, ::Hash>]
|
572
701
|
# Required. Input configurations.
|
573
|
-
# The total number of files matched should be <=
|
702
|
+
# The total number of files matched should be <= 100.
|
574
703
|
# The total content size should be <= 100M Unicode codepoints.
|
575
704
|
# The files must use UTF-8 encoding.
|
576
705
|
# @param output_config [::Google::Cloud::Translate::V3::OutputConfig, ::Hash]
|
@@ -588,7 +717,8 @@ module Google
|
|
588
717
|
# characters, underscores and dashes. International characters are allowed.
|
589
718
|
# Label values are optional. Label keys must start with a letter.
|
590
719
|
#
|
591
|
-
# See https://cloud.google.com/translate/docs/labels for more
|
720
|
+
# See https://cloud.google.com/translate/docs/advanced/labels for more
|
721
|
+
# information.
|
592
722
|
#
|
593
723
|
# @yield [response, operation] Access the result along with the RPC operation
|
594
724
|
# @yieldparam response [::Gapic::Operation]
|
@@ -638,6 +768,134 @@ module Google
|
|
638
768
|
raise ::Google::Cloud::Error.from_error(e)
|
639
769
|
end
|
640
770
|
|
771
|
+
##
|
772
|
+
# Translates a large volume of document in asynchronous batch mode.
|
773
|
+
# This function provides real-time output as the inputs are being processed.
|
774
|
+
# If caller cancels a request, the partial results (for an input file, it's
|
775
|
+
# all or nothing) may still be available on the specified output location.
|
776
|
+
#
|
777
|
+
# This call returns immediately and you can use
|
778
|
+
# google.longrunning.Operation.name to poll the status of the call.
|
779
|
+
#
|
780
|
+
# @overload batch_translate_document(request, options = nil)
|
781
|
+
# Pass arguments to `batch_translate_document` via a request object, either of type
|
782
|
+
# {::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest} or an equivalent Hash.
|
783
|
+
#
|
784
|
+
# @param request [::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest, ::Hash]
|
785
|
+
# A request object representing the call parameters. Required. To specify no
|
786
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
787
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
788
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
789
|
+
#
|
790
|
+
# @overload 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)
|
791
|
+
# Pass arguments to `batch_translate_document` via keyword arguments. Note that at
|
792
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
793
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
794
|
+
#
|
795
|
+
# @param parent [::String]
|
796
|
+
# Required. Location to make a regional call.
|
797
|
+
#
|
798
|
+
# Format: `projects/{project-number-or-id}/locations/{location-id}`.
|
799
|
+
#
|
800
|
+
# The `global` location is not supported for batch translation.
|
801
|
+
#
|
802
|
+
# Only AutoML Translation models or glossaries within the same region (have
|
803
|
+
# the same location-id) can be used, otherwise an INVALID_ARGUMENT (400)
|
804
|
+
# error is returned.
|
805
|
+
# @param source_language_code [::String]
|
806
|
+
# Required. The BCP-47 language code of the input document if known, for
|
807
|
+
# example, "en-US" or "sr-Latn". Supported language codes are listed in
|
808
|
+
# Language Support (https://cloud.google.com/translate/docs/languages).
|
809
|
+
# @param target_language_codes [::Array<::String>]
|
810
|
+
# Required. The BCP-47 language code to use for translation of the input
|
811
|
+
# document. Specify up to 10 language codes here.
|
812
|
+
# @param input_configs [::Array<::Google::Cloud::Translate::V3::BatchDocumentInputConfig, ::Hash>]
|
813
|
+
# Required. Input configurations.
|
814
|
+
# The total number of files matched should be <= 100.
|
815
|
+
# The total content size to translate should be <= 100M Unicode codepoints.
|
816
|
+
# The files must use UTF-8 encoding.
|
817
|
+
# @param output_config [::Google::Cloud::Translate::V3::BatchDocumentOutputConfig, ::Hash]
|
818
|
+
# Required. Output configuration.
|
819
|
+
# If 2 input configs match to the same file (that is, same input path),
|
820
|
+
# we don't generate output for duplicate inputs.
|
821
|
+
# @param models [::Hash{::String => ::String}]
|
822
|
+
# Optional. The models to use for translation. Map's key is target language
|
823
|
+
# code. Map's value is the model name. Value can be a built-in general model,
|
824
|
+
# or an AutoML Translation model.
|
825
|
+
#
|
826
|
+
# The value format depends on model type:
|
827
|
+
#
|
828
|
+
# - AutoML Translation models:
|
829
|
+
# `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
|
830
|
+
#
|
831
|
+
# - General (built-in) models:
|
832
|
+
# `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
|
833
|
+
#
|
834
|
+
#
|
835
|
+
# If the map is empty or a specific model is
|
836
|
+
# not requested for a language pair, then default google model (nmt) is used.
|
837
|
+
# @param glossaries [::Hash{::String => ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig, ::Hash}]
|
838
|
+
# Optional. Glossaries to be applied. It's keyed by target language code.
|
839
|
+
# @param format_conversions [::Hash{::String => ::String}]
|
840
|
+
# Optional. File format conversion map to be applied to all input files.
|
841
|
+
# Map's key is the original mime_type. Map's value is the target mime_type of
|
842
|
+
# translated documents.
|
843
|
+
#
|
844
|
+
# Supported file format conversion includes:
|
845
|
+
# - `application/pdf` to
|
846
|
+
# `application/vnd.openxmlformats-officedocument.wordprocessingml.document`
|
847
|
+
#
|
848
|
+
# If nothing specified, output files will be in the same format as the
|
849
|
+
# original file.
|
850
|
+
#
|
851
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
852
|
+
# @yieldparam response [::Gapic::Operation]
|
853
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
854
|
+
#
|
855
|
+
# @return [::Gapic::Operation]
|
856
|
+
#
|
857
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
858
|
+
#
|
859
|
+
def batch_translate_document request, options = nil
|
860
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
861
|
+
|
862
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Translate::V3::BatchTranslateDocumentRequest
|
863
|
+
|
864
|
+
# Converts hash and nil to an options object
|
865
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
866
|
+
|
867
|
+
# Customize the options with defaults
|
868
|
+
metadata = @config.rpcs.batch_translate_document.metadata.to_h
|
869
|
+
|
870
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
871
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
872
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
873
|
+
gapic_version: ::Google::Cloud::Translate::V3::VERSION
|
874
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
875
|
+
|
876
|
+
header_params = {
|
877
|
+
"parent" => request.parent
|
878
|
+
}
|
879
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
880
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
881
|
+
|
882
|
+
options.apply_defaults timeout: @config.rpcs.batch_translate_document.timeout,
|
883
|
+
metadata: metadata,
|
884
|
+
retry_policy: @config.rpcs.batch_translate_document.retry_policy
|
885
|
+
|
886
|
+
options.apply_defaults timeout: @config.timeout,
|
887
|
+
metadata: @config.metadata,
|
888
|
+
retry_policy: @config.retry_policy
|
889
|
+
|
890
|
+
@translation_service_stub.call_rpc :batch_translate_document, request, options: options do |response, operation|
|
891
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
892
|
+
yield response, operation if block_given?
|
893
|
+
return response
|
894
|
+
end
|
895
|
+
rescue ::GRPC::BadStatus => e
|
896
|
+
raise ::Google::Cloud::Error.from_error(e)
|
897
|
+
end
|
898
|
+
|
641
899
|
##
|
642
900
|
# Creates a glossary and returns the long-running operation. Returns
|
643
901
|
# NOT_FOUND, if the project doesn't exist.
|
@@ -741,7 +999,20 @@ module Google
|
|
741
999
|
# The first page is returned if `page_token`is empty or missing.
|
742
1000
|
# @param filter [::String]
|
743
1001
|
# Optional. Filter specifying constraints of a list operation.
|
744
|
-
#
|
1002
|
+
# Specify the constraint by the format of "key=value", where key must be
|
1003
|
+
# "src" or "tgt", and the value must be a valid language code.
|
1004
|
+
# For multiple restrictions, concatenate them by "AND" (uppercase only),
|
1005
|
+
# such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used
|
1006
|
+
# here, which means using 'en-US' and 'en' can lead to different results,
|
1007
|
+
# which depends on the language code you used when you create the glossary.
|
1008
|
+
# For the unidirectional glossaries, the "src" and "tgt" add restrictions
|
1009
|
+
# on the source and target language code separately.
|
1010
|
+
# For the equivalent term set glossaries, the "src" and/or "tgt" add
|
1011
|
+
# restrictions on the term set.
|
1012
|
+
# For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional
|
1013
|
+
# glossaries which exactly match the source language code as "en-US" and the
|
1014
|
+
# target language code "zh-CN", but all equivalent term set glossaries which
|
1015
|
+
# contain "en-US" and "zh-CN" in their language set will be picked.
|
745
1016
|
# If missing, no filtering is performed.
|
746
1017
|
#
|
747
1018
|
# @yield [response, operation] Access the result along with the RPC operation
|
@@ -1083,11 +1354,21 @@ module Google
|
|
1083
1354
|
#
|
1084
1355
|
attr_reader :get_supported_languages
|
1085
1356
|
##
|
1357
|
+
# RPC-specific configuration for `translate_document`
|
1358
|
+
# @return [::Gapic::Config::Method]
|
1359
|
+
#
|
1360
|
+
attr_reader :translate_document
|
1361
|
+
##
|
1086
1362
|
# RPC-specific configuration for `batch_translate_text`
|
1087
1363
|
# @return [::Gapic::Config::Method]
|
1088
1364
|
#
|
1089
1365
|
attr_reader :batch_translate_text
|
1090
1366
|
##
|
1367
|
+
# RPC-specific configuration for `batch_translate_document`
|
1368
|
+
# @return [::Gapic::Config::Method]
|
1369
|
+
#
|
1370
|
+
attr_reader :batch_translate_document
|
1371
|
+
##
|
1091
1372
|
# RPC-specific configuration for `create_glossary`
|
1092
1373
|
# @return [::Gapic::Config::Method]
|
1093
1374
|
#
|
@@ -1116,8 +1397,12 @@ module Google
|
|
1116
1397
|
@detect_language = ::Gapic::Config::Method.new detect_language_config
|
1117
1398
|
get_supported_languages_config = parent_rpcs.get_supported_languages if parent_rpcs.respond_to? :get_supported_languages
|
1118
1399
|
@get_supported_languages = ::Gapic::Config::Method.new get_supported_languages_config
|
1400
|
+
translate_document_config = parent_rpcs.translate_document if parent_rpcs.respond_to? :translate_document
|
1401
|
+
@translate_document = ::Gapic::Config::Method.new translate_document_config
|
1119
1402
|
batch_translate_text_config = parent_rpcs.batch_translate_text if parent_rpcs.respond_to? :batch_translate_text
|
1120
1403
|
@batch_translate_text = ::Gapic::Config::Method.new batch_translate_text_config
|
1404
|
+
batch_translate_document_config = parent_rpcs.batch_translate_document if parent_rpcs.respond_to? :batch_translate_document
|
1405
|
+
@batch_translate_document = ::Gapic::Config::Method.new batch_translate_document_config
|
1121
1406
|
create_glossary_config = parent_rpcs.create_glossary if parent_rpcs.respond_to? :create_glossary
|
1122
1407
|
@create_glossary = ::Gapic::Config::Method.new create_glossary_config
|
1123
1408
|
list_glossaries_config = parent_rpcs.list_glossaries if parent_rpcs.respond_to? :list_glossaries
|
@@ -8,7 +8,9 @@ require 'google/api/client_pb'
|
|
8
8
|
require 'google/api/field_behavior_pb'
|
9
9
|
require 'google/api/resource_pb'
|
10
10
|
require 'google/longrunning/operations_pb'
|
11
|
+
require 'google/protobuf/empty_pb'
|
11
12
|
require 'google/protobuf/timestamp_pb'
|
13
|
+
require 'google/rpc/status_pb'
|
12
14
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
13
15
|
add_file("google/cloud/translate/v3/translation_service.proto", :syntax => :proto3) do
|
14
16
|
add_message "google.cloud.translation.v3.TranslateTextGlossaryConfig" do
|
@@ -82,6 +84,40 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
82
84
|
optional :gcs_destination, :message, 1, "google.cloud.translation.v3.GcsDestination"
|
83
85
|
end
|
84
86
|
end
|
87
|
+
add_message "google.cloud.translation.v3.DocumentInputConfig" do
|
88
|
+
optional :mime_type, :string, 4
|
89
|
+
oneof :source do
|
90
|
+
optional :content, :bytes, 1
|
91
|
+
optional :gcs_source, :message, 2, "google.cloud.translation.v3.GcsSource"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
add_message "google.cloud.translation.v3.DocumentOutputConfig" do
|
95
|
+
optional :mime_type, :string, 3
|
96
|
+
oneof :destination do
|
97
|
+
optional :gcs_destination, :message, 1, "google.cloud.translation.v3.GcsDestination"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
add_message "google.cloud.translation.v3.TranslateDocumentRequest" do
|
101
|
+
optional :parent, :string, 1
|
102
|
+
optional :source_language_code, :string, 2
|
103
|
+
optional :target_language_code, :string, 3
|
104
|
+
optional :document_input_config, :message, 4, "google.cloud.translation.v3.DocumentInputConfig"
|
105
|
+
optional :document_output_config, :message, 5, "google.cloud.translation.v3.DocumentOutputConfig"
|
106
|
+
optional :model, :string, 6
|
107
|
+
optional :glossary_config, :message, 7, "google.cloud.translation.v3.TranslateTextGlossaryConfig"
|
108
|
+
map :labels, :string, :string, 8
|
109
|
+
end
|
110
|
+
add_message "google.cloud.translation.v3.DocumentTranslation" do
|
111
|
+
repeated :byte_stream_outputs, :bytes, 1
|
112
|
+
optional :mime_type, :string, 2
|
113
|
+
optional :detected_language_code, :string, 3
|
114
|
+
end
|
115
|
+
add_message "google.cloud.translation.v3.TranslateDocumentResponse" do
|
116
|
+
optional :document_translation, :message, 1, "google.cloud.translation.v3.DocumentTranslation"
|
117
|
+
optional :glossary_document_translation, :message, 2, "google.cloud.translation.v3.DocumentTranslation"
|
118
|
+
optional :model, :string, 3
|
119
|
+
optional :glossary_config, :message, 4, "google.cloud.translation.v3.TranslateTextGlossaryConfig"
|
120
|
+
end
|
85
121
|
add_message "google.cloud.translation.v3.BatchTranslateTextRequest" do
|
86
122
|
optional :parent, :string, 1
|
87
123
|
optional :source_language_code, :string, 2
|
@@ -188,6 +224,58 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
188
224
|
optional :submit_time, :message, 2, "google.protobuf.Timestamp"
|
189
225
|
optional :end_time, :message, 3, "google.protobuf.Timestamp"
|
190
226
|
end
|
227
|
+
add_message "google.cloud.translation.v3.BatchTranslateDocumentRequest" do
|
228
|
+
optional :parent, :string, 1
|
229
|
+
optional :source_language_code, :string, 2
|
230
|
+
repeated :target_language_codes, :string, 3
|
231
|
+
repeated :input_configs, :message, 4, "google.cloud.translation.v3.BatchDocumentInputConfig"
|
232
|
+
optional :output_config, :message, 5, "google.cloud.translation.v3.BatchDocumentOutputConfig"
|
233
|
+
map :models, :string, :string, 6
|
234
|
+
map :glossaries, :string, :message, 7, "google.cloud.translation.v3.TranslateTextGlossaryConfig"
|
235
|
+
map :format_conversions, :string, :string, 8
|
236
|
+
end
|
237
|
+
add_message "google.cloud.translation.v3.BatchDocumentInputConfig" do
|
238
|
+
oneof :source do
|
239
|
+
optional :gcs_source, :message, 1, "google.cloud.translation.v3.GcsSource"
|
240
|
+
end
|
241
|
+
end
|
242
|
+
add_message "google.cloud.translation.v3.BatchDocumentOutputConfig" do
|
243
|
+
oneof :destination do
|
244
|
+
optional :gcs_destination, :message, 1, "google.cloud.translation.v3.GcsDestination"
|
245
|
+
end
|
246
|
+
end
|
247
|
+
add_message "google.cloud.translation.v3.BatchTranslateDocumentResponse" do
|
248
|
+
optional :total_pages, :int64, 1
|
249
|
+
optional :translated_pages, :int64, 2
|
250
|
+
optional :failed_pages, :int64, 3
|
251
|
+
optional :total_billable_pages, :int64, 4
|
252
|
+
optional :total_characters, :int64, 5
|
253
|
+
optional :translated_characters, :int64, 6
|
254
|
+
optional :failed_characters, :int64, 7
|
255
|
+
optional :total_billable_characters, :int64, 8
|
256
|
+
optional :submit_time, :message, 9, "google.protobuf.Timestamp"
|
257
|
+
optional :end_time, :message, 10, "google.protobuf.Timestamp"
|
258
|
+
end
|
259
|
+
add_message "google.cloud.translation.v3.BatchTranslateDocumentMetadata" do
|
260
|
+
optional :state, :enum, 1, "google.cloud.translation.v3.BatchTranslateDocumentMetadata.State"
|
261
|
+
optional :total_pages, :int64, 2
|
262
|
+
optional :translated_pages, :int64, 3
|
263
|
+
optional :failed_pages, :int64, 4
|
264
|
+
optional :total_billable_pages, :int64, 5
|
265
|
+
optional :total_characters, :int64, 6
|
266
|
+
optional :translated_characters, :int64, 7
|
267
|
+
optional :failed_characters, :int64, 8
|
268
|
+
optional :total_billable_characters, :int64, 9
|
269
|
+
optional :submit_time, :message, 10, "google.protobuf.Timestamp"
|
270
|
+
end
|
271
|
+
add_enum "google.cloud.translation.v3.BatchTranslateDocumentMetadata.State" do
|
272
|
+
value :STATE_UNSPECIFIED, 0
|
273
|
+
value :RUNNING, 1
|
274
|
+
value :SUCCEEDED, 2
|
275
|
+
value :FAILED, 3
|
276
|
+
value :CANCELLING, 4
|
277
|
+
value :CANCELLED, 5
|
278
|
+
end
|
191
279
|
end
|
192
280
|
end
|
193
281
|
|
@@ -209,6 +297,11 @@ module Google
|
|
209
297
|
InputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.InputConfig").msgclass
|
210
298
|
GcsDestination = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.GcsDestination").msgclass
|
211
299
|
OutputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.OutputConfig").msgclass
|
300
|
+
DocumentInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DocumentInputConfig").msgclass
|
301
|
+
DocumentOutputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DocumentOutputConfig").msgclass
|
302
|
+
TranslateDocumentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.TranslateDocumentRequest").msgclass
|
303
|
+
DocumentTranslation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DocumentTranslation").msgclass
|
304
|
+
TranslateDocumentResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.TranslateDocumentResponse").msgclass
|
212
305
|
BatchTranslateTextRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateTextRequest").msgclass
|
213
306
|
BatchTranslateMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateMetadata").msgclass
|
214
307
|
BatchTranslateMetadata::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateMetadata.State").enummodule
|
@@ -227,6 +320,12 @@ module Google
|
|
227
320
|
DeleteGlossaryMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteGlossaryMetadata").msgclass
|
228
321
|
DeleteGlossaryMetadata::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteGlossaryMetadata.State").enummodule
|
229
322
|
DeleteGlossaryResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.DeleteGlossaryResponse").msgclass
|
323
|
+
BatchTranslateDocumentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateDocumentRequest").msgclass
|
324
|
+
BatchDocumentInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchDocumentInputConfig").msgclass
|
325
|
+
BatchDocumentOutputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchDocumentOutputConfig").msgclass
|
326
|
+
BatchTranslateDocumentResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateDocumentResponse").msgclass
|
327
|
+
BatchTranslateDocumentMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateDocumentMetadata").msgclass
|
328
|
+
BatchTranslateDocumentMetadata::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.translation.v3.BatchTranslateDocumentMetadata.State").enummodule
|
230
329
|
end
|
231
330
|
end
|
232
331
|
end
|