google-cloud-translate-v3 0.5.2 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/rest"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/translate/v3/version"
24
+
25
+ require "google/cloud/translate/v3/translation_service/credentials"
26
+ require "google/cloud/translate/v3/translation_service/paths"
27
+ require "google/cloud/translate/v3/translation_service/rest/operations"
28
+ require "google/cloud/translate/v3/translation_service/rest/client"
29
+
30
+ module Google
31
+ module Cloud
32
+ module Translate
33
+ module V3
34
+ ##
35
+ # Provides natural language translation operations.
36
+ #
37
+ # To load this service and instantiate a REST client:
38
+ #
39
+ # require "google/cloud/translate/v3/translation_service/rest"
40
+ # client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
41
+ #
42
+ module TranslationService
43
+ # Client for the REST transport
44
+ module Rest
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+
52
+ helper_path = ::File.join __dir__, "rest", "helpers.rb"
53
+ require "google/cloud/translate/v3/translation_service/rest/helpers" if ::File.file? helper_path
@@ -26,6 +26,7 @@ require "google/cloud/translate/v3/translation_service/credentials"
26
26
  require "google/cloud/translate/v3/translation_service/paths"
27
27
  require "google/cloud/translate/v3/translation_service/operations"
28
28
  require "google/cloud/translate/v3/translation_service/client"
29
+ require "google/cloud/translate/v3/translation_service/rest"
29
30
 
30
31
  module Google
31
32
  module Cloud
@@ -39,6 +40,11 @@ module Google
39
40
  # require "google/cloud/translate/v3/translation_service"
40
41
  # client = ::Google::Cloud::Translate::V3::TranslationService::Client.new
41
42
  #
43
+ # @example Load this service and instantiate a REST client
44
+ #
45
+ # require "google/cloud/translate/v3/translation_service/rest"
46
+ # client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
47
+ #
42
48
  module TranslationService
43
49
  end
44
50
  end
@@ -105,6 +105,9 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
105
105
  optional :model, :string, 6
106
106
  optional :glossary_config, :message, 7, "google.cloud.translation.v3.TranslateTextGlossaryConfig"
107
107
  map :labels, :string, :string, 8
108
+ optional :customized_attribution, :string, 10
109
+ optional :is_translate_native_pdf_only, :bool, 11
110
+ optional :enable_shadow_removal_native_pdf, :bool, 12
108
111
  end
109
112
  add_message "google.cloud.translation.v3.DocumentTranslation" do
110
113
  repeated :byte_stream_outputs, :bytes, 1
@@ -160,6 +163,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
160
163
  optional :entry_count, :int32, 6
161
164
  optional :submit_time, :message, 7, "google.protobuf.Timestamp"
162
165
  optional :end_time, :message, 8, "google.protobuf.Timestamp"
166
+ optional :display_name, :string, 9
163
167
  oneof :languages do
164
168
  optional :language_pair, :message, 3, "google.cloud.translation.v3.Glossary.LanguageCodePair"
165
169
  optional :language_codes_set, :message, 4, "google.cloud.translation.v3.Glossary.LanguageCodesSet"
@@ -232,6 +236,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
232
236
  map :models, :string, :string, 6
233
237
  map :glossaries, :string, :message, 7, "google.cloud.translation.v3.TranslateTextGlossaryConfig"
234
238
  map :format_conversions, :string, :string, 8
239
+ optional :customized_attribution, :string, 10
235
240
  end
236
241
  add_message "google.cloud.translation.v3.BatchDocumentInputConfig" do
237
242
  oneof :source do
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module Translate
23
23
  module V3
24
- VERSION = "0.5.2"
24
+ VERSION = "0.6.0"
25
25
  end
26
26
  end
27
27
  end
@@ -30,6 +30,11 @@ module Google
30
30
  # require "google/cloud/translate/v3"
31
31
  # client = ::Google::Cloud::Translate::V3::TranslationService::Client.new
32
32
  #
33
+ # @example Load this package, including all its services, and instantiate a REST client
34
+ #
35
+ # require "google/cloud/translate/v3"
36
+ # client = ::Google::Cloud::Translate::V3::TranslationService::Rest::Client.new
37
+ #
33
38
  module V3
34
39
  end
35
40
  end
@@ -27,14 +27,14 @@ module Google
27
27
  # @return [::String]
28
28
  # Required. The `glossary` to be applied for this translation.
29
29
  #
30
- # The format depends on glossary:
30
+ # The format depends on the glossary:
31
31
  #
32
- # - User provided custom glossary:
32
+ # - User-provided custom glossary:
33
33
  # `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`
34
34
  # @!attribute [rw] ignore_case
35
35
  # @return [::Boolean]
36
- # Optional. Indicates match is case-insensitive.
37
- # Default value is false if missing.
36
+ # Optional. Indicates match is case insensitive. The default value is `false`
37
+ # if missing.
38
38
  class TranslateTextGlossaryConfig
39
39
  include ::Google::Protobuf::MessageExts
40
40
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -44,23 +44,22 @@ module Google
44
44
  # @!attribute [rw] contents
45
45
  # @return [::Array<::String>]
46
46
  # Required. The content of the input in string format.
47
- # We recommend the total content be less than 30k codepoints. The max length
48
- # of this field is 1024.
49
- # Use BatchTranslateText for larger text.
47
+ # We recommend the total content be less than 30,000 codepoints. The max
48
+ # length of this field is 1024. Use BatchTranslateText for larger text.
50
49
  # @!attribute [rw] mime_type
51
50
  # @return [::String]
52
51
  # Optional. The format of the source text, for example, "text/html",
53
52
  # "text/plain". If left blank, the MIME type defaults to "text/html".
54
53
  # @!attribute [rw] source_language_code
55
54
  # @return [::String]
56
- # Optional. The BCP-47 language code of the input text if
55
+ # Optional. The ISO-639 language code of the input text if
57
56
  # known, for example, "en-US" or "sr-Latn". Supported language codes are
58
57
  # listed in Language Support. If the source language isn't specified, the API
59
58
  # attempts to identify the source language automatically and returns the
60
59
  # source language within the response.
61
60
  # @!attribute [rw] target_language_code
62
61
  # @return [::String]
63
- # Required. The BCP-47 language code to use for translation of the input
62
+ # Required. The ISO-639 language code to use for translation of the input
64
63
  # text, set to one of the language codes listed in Language Support.
65
64
  # @!attribute [rw] parent
66
65
  # @return [::String]
@@ -161,7 +160,7 @@ module Google
161
160
  # `projects/{project-number}/locations/{location-id}/models/general/nmt`.
162
161
  # @!attribute [rw] detected_language_code
163
162
  # @return [::String]
164
- # The BCP-47 language code of source text in the initial request, detected
163
+ # The ISO-639 language code of source text in the initial request, detected
165
164
  # automatically, if no source language was passed within the initial
166
165
  # request. If the source language was passed, auto-detection of the language
167
166
  # does not occur and this field is empty.
@@ -233,7 +232,7 @@ module Google
233
232
  # The response message for language detection.
234
233
  # @!attribute [rw] language_code
235
234
  # @return [::String]
236
- # The BCP-47 language code of source content in the request, detected
235
+ # The ISO-639 language code of the source content in the request, detected
237
236
  # automatically.
238
237
  # @!attribute [rw] confidence
239
238
  # @return [::Float]
@@ -309,19 +308,19 @@ module Google
309
308
  # @!attribute [rw] language_code
310
309
  # @return [::String]
311
310
  # Supported language code, generally consisting of its ISO 639-1
312
- # identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes
311
+ # identifier, for example, 'en', 'ja'. In certain cases, ISO-639 codes
313
312
  # including language and region identifiers are returned (for example,
314
- # 'zh-TW' and 'zh-CN')
313
+ # 'zh-TW' and 'zh-CN').
315
314
  # @!attribute [rw] display_name
316
315
  # @return [::String]
317
- # Human readable name of the language localized in the display language
316
+ # Human-readable name of the language localized in the display language
318
317
  # specified in the request.
319
318
  # @!attribute [rw] support_source
320
319
  # @return [::Boolean]
321
- # Can be used as source language.
320
+ # Can be used as a source language.
322
321
  # @!attribute [rw] support_target
323
322
  # @return [::Boolean]
324
- # Can be used as target language.
323
+ # Can be used as a target language.
325
324
  class SupportedLanguage
326
325
  include ::Google::Protobuf::MessageExts
327
326
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -419,7 +418,7 @@ module Google
419
418
  # Since index.csv will be keeping updated during the process, please make
420
419
  # sure there is no custom retention policy applied on the output bucket
421
420
  # that may avoid file updating.
422
- # (https://cloud.google.com/storage/docs/bucket-lock?hl=en#retention-policy)
421
+ # (https://cloud.google.com/storage/docs/bucket-lock#retention-policy)
423
422
  #
424
423
  # The format of translations_file (for target language code 'trg') is:
425
424
  # `gs://translation_test/a_b_c_'trg'_translations.[extension]`
@@ -564,7 +563,7 @@ module Google
564
563
  # location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
565
564
  # @!attribute [rw] source_language_code
566
565
  # @return [::String]
567
- # Optional. The BCP-47 language code of the input document if known, for
566
+ # Optional. The ISO-639 language code of the input document if known, for
568
567
  # example, "en-US" or "sr-Latn". Supported language codes are listed in
569
568
  # Language Support. If the source language isn't specified, the API attempts
570
569
  # to identify the source language automatically and returns the source
@@ -572,7 +571,7 @@ module Google
572
571
  # request contains a glossary or a custom model.
573
572
  # @!attribute [rw] target_language_code
574
573
  # @return [::String]
575
- # Required. The BCP-47 language code to use for translation of the input
574
+ # Required. The ISO-639 language code to use for translation of the input
576
575
  # document, set to one of the language codes listed in Language Support.
577
576
  # @!attribute [rw] document_input_config
578
577
  # @return [::Google::Cloud::Translate::V3::DocumentInputConfig]
@@ -615,6 +614,22 @@ module Google
615
614
  #
616
615
  # See https://cloud.google.com/translate/docs/advanced/labels for more
617
616
  # information.
617
+ # @!attribute [rw] customized_attribution
618
+ # @return [::String]
619
+ # Optional. This flag is to support user customized attribution.
620
+ # If not provided, the default is `Machine Translated by Google`.
621
+ # Customized attribution should follow rules in
622
+ # https://cloud.google.com/translate/attribution#attribution_and_logos
623
+ # @!attribute [rw] is_translate_native_pdf_only
624
+ # @return [::Boolean]
625
+ # Optional. If true, the page limit of online native pdf translation is 300
626
+ # and only native pdf pages will be translated.
627
+ # @!attribute [rw] enable_shadow_removal_native_pdf
628
+ # @return [::Boolean]
629
+ # Optional. If true, use the text removal to remove the shadow text on
630
+ # background image for native pdf translation.
631
+ # Shadow removal feature can only be enabled when
632
+ # is_translate_native_pdf_only is false
618
633
  class TranslateDocumentRequest
619
634
  include ::Google::Protobuf::MessageExts
620
635
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -856,10 +871,10 @@ module Google
856
871
  #
857
872
  # For unidirectional glossaries:
858
873
  #
859
- # - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated.
874
+ # - TSV/CSV (`.tsv`/`.csv`): Two column file, tab- or comma-separated.
860
875
  # The first column is source text. The second column is target text.
861
- # The file must not contain headers. That is, the first row is data, not
862
- # column names.
876
+ # No headers in this file. The first row contains data and not column
877
+ # names.
863
878
  #
864
879
  # - TMX (`.tmx`): TMX file with parallel data defining source/target term
865
880
  # pairs.
@@ -874,7 +889,7 @@ module Google
874
889
  extend ::Google::Protobuf::MessageExts::ClassMethods
875
890
  end
876
891
 
877
- # Represents a glossary built from user provided data.
892
+ # Represents a glossary built from user-provided data.
878
893
  # @!attribute [rw] name
879
894
  # @return [::String]
880
895
  # Required. The resource name of the glossary. Glossary names have the form
@@ -898,6 +913,9 @@ module Google
898
913
  # @!attribute [r] end_time
899
914
  # @return [::Google::Protobuf::Timestamp]
900
915
  # Output only. When the glossary creation was finished.
916
+ # @!attribute [rw] display_name
917
+ # @return [::String]
918
+ # Optional. The display name of the glossary.
901
919
  class Glossary
902
920
  include ::Google::Protobuf::MessageExts
903
921
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -905,11 +923,11 @@ module Google
905
923
  # Used with unidirectional glossaries.
906
924
  # @!attribute [rw] source_language_code
907
925
  # @return [::String]
908
- # Required. The BCP-47 language code of the input text, for example,
926
+ # Required. The ISO-639 language code of the input text, for example,
909
927
  # "en-US". Expected to be an exact match for GlossaryTerm.language_code.
910
928
  # @!attribute [rw] target_language_code
911
929
  # @return [::String]
912
- # Required. The BCP-47 language code for translation output, for example,
930
+ # Required. The ISO-639 language code for translation output, for example,
913
931
  # "zh-CN". Expected to be an exact match for GlossaryTerm.language_code.
914
932
  class LanguageCodePair
915
933
  include ::Google::Protobuf::MessageExts
@@ -919,7 +937,7 @@ module Google
919
937
  # Used with equivalent term set glossaries.
920
938
  # @!attribute [rw] language_codes
921
939
  # @return [::Array<::String>]
922
- # The BCP-47 language code(s) for terms defined in the glossary.
940
+ # The ISO-639 language code(s) for terms defined in the glossary.
923
941
  # All entries are unique. The list contains at least two entries.
924
942
  # Expected to be an exact match for GlossaryTerm.language_code.
925
943
  class LanguageCodesSet
@@ -1120,12 +1138,12 @@ module Google
1120
1138
  # error is returned.
1121
1139
  # @!attribute [rw] source_language_code
1122
1140
  # @return [::String]
1123
- # Required. The BCP-47 language code of the input document if known, for
1141
+ # Required. The ISO-639 language code of the input document if known, for
1124
1142
  # example, "en-US" or "sr-Latn". Supported language codes are listed in
1125
- # Language Support (https://cloud.google.com/translate/docs/languages).
1143
+ # [Language Support](https://cloud.google.com/translate/docs/languages).
1126
1144
  # @!attribute [rw] target_language_codes
1127
1145
  # @return [::Array<::String>]
1128
- # Required. The BCP-47 language code to use for translation of the input
1146
+ # Required. The ISO-639 language code to use for translation of the input
1129
1147
  # document. Specify up to 10 language codes here.
1130
1148
  # @!attribute [rw] input_configs
1131
1149
  # @return [::Array<::Google::Cloud::Translate::V3::BatchDocumentInputConfig>]
@@ -1170,6 +1188,12 @@ module Google
1170
1188
  #
1171
1189
  # If nothing specified, output files will be in the same format as the
1172
1190
  # original file.
1191
+ # @!attribute [rw] customized_attribution
1192
+ # @return [::String]
1193
+ # Optional. This flag is to support user customized attribution.
1194
+ # If not provided, the default is `Machine Translated by Google`.
1195
+ # Customized attribution should follow rules in
1196
+ # https://cloud.google.com/translate/attribution#attribution_and_logos
1173
1197
  class BatchTranslateDocumentRequest
1174
1198
  include ::Google::Protobuf::MessageExts
1175
1199
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -1263,7 +1287,7 @@ module Google
1263
1287
  # Since index.csv will be keeping updated during the process, please make
1264
1288
  # sure there is no custom retention policy applied on the output bucket
1265
1289
  # that may avoid file updating.
1266
- # (https://cloud.google.com/storage/docs/bucket-lock?hl=en#retention-policy)
1290
+ # (https://cloud.google.com/storage/docs/bucket-lock#retention-policy)
1267
1291
  #
1268
1292
  # The naming format of translation output files follows (for target
1269
1293
  # language code [trg]): `translation_output`:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-translate-v3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-17 00:00:00.000000000 Z
11
+ date: 2023-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gapic-common
@@ -172,11 +172,16 @@ files:
172
172
  - README.md
173
173
  - lib/google-cloud-translate-v3.rb
174
174
  - lib/google/cloud/translate/v3.rb
175
+ - lib/google/cloud/translate/v3/rest.rb
175
176
  - lib/google/cloud/translate/v3/translation_service.rb
176
177
  - lib/google/cloud/translate/v3/translation_service/client.rb
177
178
  - lib/google/cloud/translate/v3/translation_service/credentials.rb
178
179
  - lib/google/cloud/translate/v3/translation_service/operations.rb
179
180
  - lib/google/cloud/translate/v3/translation_service/paths.rb
181
+ - lib/google/cloud/translate/v3/translation_service/rest.rb
182
+ - lib/google/cloud/translate/v3/translation_service/rest/client.rb
183
+ - lib/google/cloud/translate/v3/translation_service/rest/operations.rb
184
+ - lib/google/cloud/translate/v3/translation_service/rest/service_stub.rb
180
185
  - lib/google/cloud/translate/v3/translation_service_pb.rb
181
186
  - lib/google/cloud/translate/v3/translation_service_services_pb.rb
182
187
  - lib/google/cloud/translate/v3/version.rb