google-cloud-translate 2.3.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +5 -8
  3. data/AUTHENTICATION.md +67 -81
  4. data/LICENSE.md +203 -0
  5. data/MIGRATING.md +302 -0
  6. data/README.md +80 -0
  7. data/lib/google-cloud-translate.rb +5 -146
  8. data/lib/google/cloud/translate.rb +81 -178
  9. data/lib/google/cloud/translate/helpers.rb +100 -0
  10. data/lib/google/cloud/translate/version.rb +6 -2
  11. metadata +35 -135
  12. data/CHANGELOG.md +0 -164
  13. data/CODE_OF_CONDUCT.md +0 -40
  14. data/CONTRIBUTING.md +0 -188
  15. data/LICENSE +0 -201
  16. data/OVERVIEW.md +0 -390
  17. data/TROUBLESHOOTING.md +0 -37
  18. data/lib/google/cloud/translate/v2.rb +0 -169
  19. data/lib/google/cloud/translate/v2/api.rb +0 -255
  20. data/lib/google/cloud/translate/v2/credentials.rb +0 -58
  21. data/lib/google/cloud/translate/v2/detection.rb +0 -132
  22. data/lib/google/cloud/translate/v2/language.rb +0 -68
  23. data/lib/google/cloud/translate/v2/service.rb +0 -209
  24. data/lib/google/cloud/translate/v2/translation.rb +0 -120
  25. data/lib/google/cloud/translate/v3.rb +0 -144
  26. data/lib/google/cloud/translate/v3/credentials.rb +0 -42
  27. data/lib/google/cloud/translate/v3/doc/google/cloud/translate/v3/translation_service.rb +0 -663
  28. data/lib/google/cloud/translate/v3/doc/google/longrunning/operations.rb +0 -51
  29. data/lib/google/cloud/translate/v3/doc/google/protobuf/any.rb +0 -131
  30. data/lib/google/cloud/translate/v3/doc/google/protobuf/timestamp.rb +0 -113
  31. data/lib/google/cloud/translate/v3/doc/google/rpc/status.rb +0 -39
  32. data/lib/google/cloud/translate/v3/translation_service_client.rb +0 -930
  33. data/lib/google/cloud/translate/v3/translation_service_client_config.json +0 -66
  34. data/lib/google/cloud/translate/v3/translation_service_pb.rb +0 -226
  35. data/lib/google/cloud/translate/v3/translation_service_services_pb.rb +0 -68
@@ -1,42 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- require "googleauth"
17
-
18
- module Google
19
- module Cloud
20
- module Translate
21
- module V3
22
- class Credentials < Google::Auth::Credentials
23
- SCOPE = [
24
- "https://www.googleapis.com/auth/cloud-platform",
25
- "https://www.googleapis.com/auth/cloud-translation"
26
- ].freeze
27
- PATH_ENV_VARS = %w(TRANSLATE_CREDENTIALS
28
- TRANSLATE_KEYFILE
29
- GOOGLE_CLOUD_CREDENTIALS
30
- GOOGLE_CLOUD_KEYFILE
31
- GCLOUD_KEYFILE)
32
- JSON_ENV_VARS = %w(TRANSLATE_CREDENTIALS_JSON
33
- TRANSLATE_KEYFILE_JSON
34
- GOOGLE_CLOUD_CREDENTIALS_JSON
35
- GOOGLE_CLOUD_KEYFILE_JSON
36
- GCLOUD_KEYFILE_JSON)
37
- DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
38
- end
39
- end
40
- end
41
- end
42
- end
@@ -1,663 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Cloud
18
- module Translate
19
- module V3
20
- # Configures which glossary should be used for a specific target language,
21
- # and defines options for applying that glossary.
22
- # @!attribute [rw] glossary
23
- # @return [String]
24
- # Required. Specifies the glossary used for this translation. Use
25
- # this format: projects/*/locations/*/glossaries/*
26
- # @!attribute [rw] ignore_case
27
- # @return [true, false]
28
- # Optional. Indicates match is case-insensitive.
29
- # Default value is false if missing.
30
- class TranslateTextGlossaryConfig; end
31
-
32
- # The request message for synchronous translation.
33
- # @!attribute [rw] contents
34
- # @return [Array<String>]
35
- # Required. The content of the input in string format.
36
- # We recommend the total content be less than 30k codepoints.
37
- # Use BatchTranslateText for larger text.
38
- # @!attribute [rw] mime_type
39
- # @return [String]
40
- # Optional. The format of the source text, for example, "text/html",
41
- # "text/plain". If left blank, the MIME type defaults to "text/html".
42
- # @!attribute [rw] source_language_code
43
- # @return [String]
44
- # Optional. The BCP-47 language code of the input text if
45
- # known, for example, "en-US" or "sr-Latn". Supported language codes are
46
- # listed in Language Support. If the source language isn't specified, the API
47
- # attempts to identify the source language automatically and returns the
48
- # source language within the response.
49
- # @!attribute [rw] target_language_code
50
- # @return [String]
51
- # Required. The BCP-47 language code to use for translation of the input
52
- # text, set to one of the language codes listed in Language Support.
53
- # @!attribute [rw] parent
54
- # @return [String]
55
- # Required. Project or location to make a call. Must refer to a caller's
56
- # project.
57
- #
58
- # Format: `projects/{project-number-or-id}` or
59
- # `projects/{project-number-or-id}/locations/{location-id}`.
60
- #
61
- # For global calls, use `projects/{project-number-or-id}/locations/global` or
62
- # `projects/{project-number-or-id}`.
63
- #
64
- # Non-global location is required for requests using AutoML models or
65
- # custom glossaries.
66
- #
67
- # Models and glossaries must be within the same region (have same
68
- # location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
69
- # @!attribute [rw] model
70
- # @return [String]
71
- # Optional. The `model` type requested for this translation.
72
- #
73
- # The format depends on model type:
74
- #
75
- # * AutoML Translation models:
76
- # `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
77
- #
78
- # * General (built-in) models:
79
- # `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
80
- # `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
81
- #
82
- #
83
- # For global (non-regionalized) requests, use `location-id` `global`.
84
- # For example,
85
- # `projects/{project-number-or-id}/locations/global/models/general/nmt`.
86
- #
87
- # If missing, the system decides which google base model to use.
88
- # @!attribute [rw] glossary_config
89
- # @return [Google::Cloud::Translate::V3::TranslateTextGlossaryConfig]
90
- # Optional. Glossary to be applied. The glossary must be
91
- # within the same region (have the same location-id) as the model, otherwise
92
- # an INVALID_ARGUMENT (400) error is returned.
93
- # @!attribute [rw] labels
94
- # @return [Hash{String => String}]
95
- # Optional. The labels with user-defined metadata for the request.
96
- #
97
- # Label keys and values can be no longer than 63 characters
98
- # (Unicode codepoints), can only contain lowercase letters, numeric
99
- # characters, underscores and dashes. International characters are allowed.
100
- # Label values are optional. Label keys must start with a letter.
101
- #
102
- # See https://cloud.google.com/translate/docs/labels for more information.
103
- class TranslateTextRequest; end
104
-
105
- # @!attribute [rw] translations
106
- # @return [Array<Google::Cloud::Translate::V3::Translation>]
107
- # Text translation responses with no glossary applied.
108
- # This field has the same length as
109
- # {Google::Cloud::Translate::V3::TranslateTextRequest#contents `contents`}.
110
- # @!attribute [rw] glossary_translations
111
- # @return [Array<Google::Cloud::Translate::V3::Translation>]
112
- # Text translation responses if a glossary is provided in the request.
113
- # This can be the same as
114
- # {Google::Cloud::Translate::V3::TranslateTextResponse#translations `translations`}
115
- # if no terms apply. This field has the same length as
116
- # {Google::Cloud::Translate::V3::TranslateTextRequest#contents `contents`}.
117
- class TranslateTextResponse; end
118
-
119
- # A single translation response.
120
- # @!attribute [rw] translated_text
121
- # @return [String]
122
- # Text translated into the target language.
123
- # @!attribute [rw] model
124
- # @return [String]
125
- # Only present when `model` is present in the request.
126
- # `model` here is normalized to have project number.
127
- #
128
- # For example:
129
- # If the `model` requested in TranslationTextRequest is
130
- # `projects/{project-id}/locations/{location-id}/models/general/nmt` then
131
- # `model` here would be normalized to
132
- # `projects/{project-number}/locations/{location-id}/models/general/nmt`.
133
- # @!attribute [rw] detected_language_code
134
- # @return [String]
135
- # The BCP-47 language code of source text in the initial request, detected
136
- # automatically, if no source language was passed within the initial
137
- # request. If the source language was passed, auto-detection of the language
138
- # does not occur and this field is empty.
139
- # @!attribute [rw] glossary_config
140
- # @return [Google::Cloud::Translate::V3::TranslateTextGlossaryConfig]
141
- # The `glossary_config` used for this translation.
142
- class Translation; end
143
-
144
- # The request message for language detection.
145
- # @!attribute [rw] parent
146
- # @return [String]
147
- # Required. Project or location to make a call. Must refer to a caller's
148
- # project.
149
- #
150
- # Format: `projects/{project-number-or-id}/locations/{location-id}` or
151
- # `projects/{project-number-or-id}`.
152
- #
153
- # For global calls, use `projects/{project-number-or-id}/locations/global` or
154
- # `projects/{project-number-or-id}`.
155
- #
156
- # Only models within the same region (has same location-id) can be used.
157
- # Otherwise an INVALID_ARGUMENT (400) error is returned.
158
- # @!attribute [rw] model
159
- # @return [String]
160
- # Optional. The language detection model to be used.
161
- #
162
- # Format:
163
- # `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}`
164
- #
165
- # Only one language detection model is currently supported:
166
- # `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`.
167
- #
168
- # If not specified, the default model is used.
169
- # @!attribute [rw] content
170
- # @return [String]
171
- # The content of the input stored as a string.
172
- # @!attribute [rw] mime_type
173
- # @return [String]
174
- # Optional. The format of the source text, for example, "text/html",
175
- # "text/plain". If left blank, the MIME type defaults to "text/html".
176
- # @!attribute [rw] labels
177
- # @return [Hash{String => String}]
178
- # Optional. The labels with user-defined metadata for the request.
179
- #
180
- # Label keys and values can be no longer than 63 characters
181
- # (Unicode codepoints), can only contain lowercase letters, numeric
182
- # characters, underscores and dashes. International characters are allowed.
183
- # Label values are optional. Label keys must start with a letter.
184
- #
185
- # See https://cloud.google.com/translate/docs/labels for more information.
186
- class DetectLanguageRequest; end
187
-
188
- # The response message for language detection.
189
- # @!attribute [rw] language_code
190
- # @return [String]
191
- # The BCP-47 language code of source content in the request, detected
192
- # automatically.
193
- # @!attribute [rw] confidence
194
- # @return [Float]
195
- # The confidence of the detection result for this language.
196
- class DetectedLanguage; end
197
-
198
- # The response message for language detection.
199
- # @!attribute [rw] languages
200
- # @return [Array<Google::Cloud::Translate::V3::DetectedLanguage>]
201
- # A list of detected languages sorted by detection confidence in descending
202
- # order. The most probable language first.
203
- class DetectLanguageResponse; end
204
-
205
- # The request message for discovering supported languages.
206
- # @!attribute [rw] parent
207
- # @return [String]
208
- # Required. Project or location to make a call. Must refer to a caller's
209
- # project.
210
- #
211
- # Format: `projects/{project-number-or-id}` or
212
- # `projects/{project-number-or-id}/locations/{location-id}`.
213
- #
214
- # For global calls, use `projects/{project-number-or-id}/locations/global` or
215
- # `projects/{project-number-or-id}`.
216
- #
217
- # Non-global location is required for AutoML models.
218
- #
219
- # Only models within the same region (have same location-id) can be used,
220
- # otherwise an INVALID_ARGUMENT (400) error is returned.
221
- # @!attribute [rw] display_language_code
222
- # @return [String]
223
- # Optional. The language to use to return localized, human readable names
224
- # of supported languages. If missing, then display names are not returned
225
- # in a response.
226
- # @!attribute [rw] model
227
- # @return [String]
228
- # Optional. Get supported languages of this model.
229
- #
230
- # The format depends on model type:
231
- #
232
- # * AutoML Translation models:
233
- # `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
234
- #
235
- # * General (built-in) models:
236
- # `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
237
- # `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
238
- #
239
- #
240
- # Returns languages supported by the specified model.
241
- # If missing, we get supported languages of Google general base (PBMT) model.
242
- class GetSupportedLanguagesRequest; end
243
-
244
- # The response message for discovering supported languages.
245
- # @!attribute [rw] languages
246
- # @return [Array<Google::Cloud::Translate::V3::SupportedLanguage>]
247
- # A list of supported language responses. This list contains an entry
248
- # for each language the Translation API supports.
249
- class SupportedLanguages; end
250
-
251
- # A single supported language response corresponds to information related
252
- # to one supported language.
253
- # @!attribute [rw] language_code
254
- # @return [String]
255
- # Supported language code, generally consisting of its ISO 639-1
256
- # identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes
257
- # including language and region identifiers are returned (for example,
258
- # 'zh-TW' and 'zh-CN')
259
- # @!attribute [rw] display_name
260
- # @return [String]
261
- # Human readable name of the language localized in the display language
262
- # specified in the request.
263
- # @!attribute [rw] support_source
264
- # @return [true, false]
265
- # Can be used as source language.
266
- # @!attribute [rw] support_target
267
- # @return [true, false]
268
- # Can be used as target language.
269
- class SupportedLanguage; end
270
-
271
- # The Google Cloud Storage location for the input content.
272
- # @!attribute [rw] input_uri
273
- # @return [String]
274
- # Required. Source data URI. For example, `gs://my_bucket/my_object`.
275
- class GcsSource; end
276
-
277
- # Input configuration for BatchTranslateText request.
278
- # @!attribute [rw] mime_type
279
- # @return [String]
280
- # Optional. Can be "text/plain" or "text/html".
281
- # For `.tsv`, "text/html" is used if mime_type is missing.
282
- # For `.html`, this field must be "text/html" or empty.
283
- # For `.txt`, this field must be "text/plain" or empty.
284
- # @!attribute [rw] gcs_source
285
- # @return [Google::Cloud::Translate::V3::GcsSource]
286
- # Required. Google Cloud Storage location for the source input.
287
- # This can be a single file (for example,
288
- # `gs://translation-test/input.tsv`) or a wildcard (for example,
289
- # `gs://translation-test/*`). If a file extension is `.tsv`, it can
290
- # contain either one or two columns. The first column (optional) is the id
291
- # of the text request. If the first column is missing, we use the row
292
- # number (0-based) from the input file as the ID in the output file. The
293
- # second column is the actual text to be
294
- # translated. We recommend each row be <= 10K Unicode codepoints,
295
- # otherwise an error might be returned.
296
- # Note that the input tsv must be RFC 4180 compliant.
297
- #
298
- # You could use https://github.com/Clever/csvlint to check potential
299
- # formatting errors in your tsv file.
300
- # csvlint --delimiter='\t' your_input_file.tsv
301
- #
302
- # The other supported file extensions are `.txt` or `.html`, which is
303
- # treated as a single large chunk of text.
304
- class InputConfig; end
305
-
306
- # The Google Cloud Storage location for the output content.
307
- # @!attribute [rw] output_uri_prefix
308
- # @return [String]
309
- # Required. There must be no files under 'output_uri_prefix'.
310
- # 'output_uri_prefix' must end with "/" and start with "gs://", otherwise an
311
- # INVALID_ARGUMENT (400) error is returned.
312
- class GcsDestination; end
313
-
314
- # Output configuration for BatchTranslateText request.
315
- # @!attribute [rw] gcs_destination
316
- # @return [Google::Cloud::Translate::V3::GcsDestination]
317
- # Google Cloud Storage destination for output content.
318
- # For every single input file (for example, gs://a/b/c.[extension]), we
319
- # generate at most 2 * n output files. (n is the # of target_language_codes
320
- # in the BatchTranslateTextRequest).
321
- #
322
- # Output files (tsv) generated are compliant with RFC 4180 except that
323
- # record delimiters are '\n' instead of '\r\n'. We don't provide any way to
324
- # change record delimiters.
325
- #
326
- # While the input files are being processed, we write/update an index file
327
- # 'index.csv' under 'output_uri_prefix' (for example,
328
- # gs://translation-test/index.csv) The index file is generated/updated as
329
- # new files are being translated. The format is:
330
- #
331
- # input_file,target_language_code,translations_file,errors_file,
332
- # glossary_translations_file,glossary_errors_file
333
- #
334
- # input_file is one file we matched using gcs_source.input_uri.
335
- # target_language_code is provided in the request.
336
- # translations_file contains the translations. (details provided below)
337
- # errors_file contains the errors during processing of the file. (details
338
- # below). Both translations_file and errors_file could be empty
339
- # strings if we have no content to output.
340
- # glossary_translations_file and glossary_errors_file are always empty
341
- # strings if the input_file is tsv. They could also be empty if we have no
342
- # content to output.
343
- #
344
- # Once a row is present in index.csv, the input/output matching never
345
- # changes. Callers should also expect all the content in input_file are
346
- # processed and ready to be consumed (that is, no partial output file is
347
- # written).
348
- #
349
- # The format of translations_file (for target language code 'trg') is:
350
- # gs://translation_test/a_b_c_'trg'_translations.[extension]
351
- #
352
- # If the input file extension is tsv, the output has the following
353
- # columns:
354
- # Column 1: ID of the request provided in the input, if it's not
355
- # provided in the input, then the input row number is used (0-based).
356
- # Column 2: source sentence.
357
- # Column 3: translation without applying a glossary. Empty string if there
358
- # is an error.
359
- # Column 4 (only present if a glossary is provided in the request):
360
- # translation after applying the glossary. Empty string if there is an
361
- # error applying the glossary. Could be same string as column 3 if there is
362
- # no glossary applied.
363
- #
364
- # If input file extension is a txt or html, the translation is directly
365
- # written to the output file. If glossary is requested, a separate
366
- # glossary_translations_file has format of
367
- # gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]
368
- #
369
- # The format of errors file (for target language code 'trg') is:
370
- # gs://translation_test/a_b_c_'trg'_errors.[extension]
371
- #
372
- # If the input file extension is tsv, errors_file contains the following:
373
- # Column 1: ID of the request provided in the input, if it's not
374
- # provided in the input, then the input row number is used (0-based).
375
- # Column 2: source sentence.
376
- # Column 3: Error detail for the translation. Could be empty.
377
- # Column 4 (only present if a glossary is provided in the request):
378
- # Error when applying the glossary.
379
- #
380
- # If the input file extension is txt or html, glossary_error_file will be
381
- # generated that contains error details. glossary_error_file has format of
382
- # gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]
383
- class OutputConfig; end
384
-
385
- # The batch translation request.
386
- # @!attribute [rw] parent
387
- # @return [String]
388
- # Required. Location to make a call. Must refer to a caller's project.
389
- #
390
- # Format: `projects/{project-number-or-id}/locations/{location-id}`.
391
- #
392
- # The `global` location is not supported for batch translation.
393
- #
394
- # Only AutoML Translation models or glossaries within the same region (have
395
- # the same location-id) can be used, otherwise an INVALID_ARGUMENT (400)
396
- # error is returned.
397
- # @!attribute [rw] source_language_code
398
- # @return [String]
399
- # Required. Source language code.
400
- # @!attribute [rw] target_language_codes
401
- # @return [Array<String>]
402
- # Required. Specify up to 10 language codes here.
403
- # @!attribute [rw] models
404
- # @return [Hash{String => String}]
405
- # Optional. The models to use for translation. Map's key is target language
406
- # code. Map's value is model name. Value can be a built-in general model,
407
- # or an AutoML Translation model.
408
- #
409
- # The value format depends on model type:
410
- #
411
- # * AutoML Translation models:
412
- # `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
413
- #
414
- # * General (built-in) models:
415
- # `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
416
- # `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
417
- #
418
- #
419
- # If the map is empty or a specific model is
420
- # not requested for a language pair, then default google model (nmt) is used.
421
- # @!attribute [rw] input_configs
422
- # @return [Array<Google::Cloud::Translate::V3::InputConfig>]
423
- # Required. Input configurations.
424
- # The total number of files matched should be <= 1000.
425
- # The total content size should be <= 100M Unicode codepoints.
426
- # The files must use UTF-8 encoding.
427
- # @!attribute [rw] output_config
428
- # @return [Google::Cloud::Translate::V3::OutputConfig]
429
- # Required. Output configuration.
430
- # If 2 input configs match to the same file (that is, same input path),
431
- # we don't generate output for duplicate inputs.
432
- # @!attribute [rw] glossaries
433
- # @return [Hash{String => Google::Cloud::Translate::V3::TranslateTextGlossaryConfig}]
434
- # Optional. Glossaries to be applied for translation.
435
- # It's keyed by target language code.
436
- # @!attribute [rw] labels
437
- # @return [Hash{String => String}]
438
- # Optional. The labels with user-defined metadata for the request.
439
- #
440
- # Label keys and values can be no longer than 63 characters
441
- # (Unicode codepoints), can only contain lowercase letters, numeric
442
- # characters, underscores and dashes. International characters are allowed.
443
- # Label values are optional. Label keys must start with a letter.
444
- #
445
- # See https://cloud.google.com/translate/docs/labels for more information.
446
- class BatchTranslateTextRequest; end
447
-
448
- # State metadata for the batch translation operation.
449
- # @!attribute [rw] state
450
- # @return [Google::Cloud::Translate::V3::BatchTranslateMetadata::State]
451
- # The state of the operation.
452
- # @!attribute [rw] translated_characters
453
- # @return [Integer]
454
- # Number of successfully translated characters so far (Unicode codepoints).
455
- # @!attribute [rw] failed_characters
456
- # @return [Integer]
457
- # Number of characters that have failed to process so far (Unicode
458
- # codepoints).
459
- # @!attribute [rw] total_characters
460
- # @return [Integer]
461
- # Total number of characters (Unicode codepoints).
462
- # This is the total number of codepoints from input files times the number of
463
- # target languages and appears here shortly after the call is submitted.
464
- # @!attribute [rw] submit_time
465
- # @return [Google::Protobuf::Timestamp]
466
- # Time when the operation was submitted.
467
- class BatchTranslateMetadata; end
468
-
469
- # Stored in the
470
- # {Google::Longrunning::Operation#response}
471
- # field returned by BatchTranslateText if at least one sentence is translated
472
- # successfully.
473
- # @!attribute [rw] total_characters
474
- # @return [Integer]
475
- # Total number of characters (Unicode codepoints).
476
- # @!attribute [rw] translated_characters
477
- # @return [Integer]
478
- # Number of successfully translated characters (Unicode codepoints).
479
- # @!attribute [rw] failed_characters
480
- # @return [Integer]
481
- # Number of characters that have failed to process (Unicode codepoints).
482
- # @!attribute [rw] submit_time
483
- # @return [Google::Protobuf::Timestamp]
484
- # Time when the operation was submitted.
485
- # @!attribute [rw] end_time
486
- # @return [Google::Protobuf::Timestamp]
487
- # The time when the operation is finished and
488
- # {Google::Longrunning::Operation#done} is
489
- # set to true.
490
- class BatchTranslateResponse; end
491
-
492
- # Input configuration for glossaries.
493
- # @!attribute [rw] gcs_source
494
- # @return [Google::Cloud::Translate::V3::GcsSource]
495
- # Required. Google Cloud Storage location of glossary data.
496
- # File format is determined based on the filename extension. API returns
497
- # [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file
498
- # formats. Wildcards are not allowed. This must be a single file in one of
499
- # the following formats:
500
- #
501
- # For unidirectional glossaries:
502
- #
503
- # * TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated.
504
- # The first column is source text. The second column is target text.
505
- # The file must not contain headers. That is, the first row is data, not
506
- # column names.
507
- #
508
- # * TMX (`.tmx`): TMX file with parallel data defining source/target term
509
- # pairs.
510
- #
511
- # For equivalent term sets glossaries:
512
- #
513
- # * CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms
514
- # in multiple languages. The format is defined for Google Translation
515
- # Toolkit and documented in [Use a
516
- # glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en).
517
- class GlossaryInputConfig; end
518
-
519
- # Represents a glossary built from user provided data.
520
- # @!attribute [rw] name
521
- # @return [String]
522
- # Required. The resource name of the glossary. Glossary names have the form
523
- # `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`.
524
- # @!attribute [rw] language_pair
525
- # @return [Google::Cloud::Translate::V3::Glossary::LanguageCodePair]
526
- # Used with unidirectional glossaries.
527
- # @!attribute [rw] language_codes_set
528
- # @return [Google::Cloud::Translate::V3::Glossary::LanguageCodesSet]
529
- # Used with equivalent term set glossaries.
530
- # @!attribute [rw] input_config
531
- # @return [Google::Cloud::Translate::V3::GlossaryInputConfig]
532
- # Required. Provides examples to build the glossary from.
533
- # Total glossary must not exceed 10M Unicode codepoints.
534
- # @!attribute [rw] entry_count
535
- # @return [Integer]
536
- # Output only. The number of entries defined in the glossary.
537
- # @!attribute [rw] submit_time
538
- # @return [Google::Protobuf::Timestamp]
539
- # Output only. When CreateGlossary was called.
540
- # @!attribute [rw] end_time
541
- # @return [Google::Protobuf::Timestamp]
542
- # Output only. When the glossary creation was finished.
543
- class Glossary
544
- # Used with unidirectional glossaries.
545
- # @!attribute [rw] source_language_code
546
- # @return [String]
547
- # Required. The BCP-47 language code of the input text, for example,
548
- # "en-US". Expected to be an exact match for GlossaryTerm.language_code.
549
- # @!attribute [rw] target_language_code
550
- # @return [String]
551
- # Required. The BCP-47 language code for translation output, for example,
552
- # "zh-CN". Expected to be an exact match for GlossaryTerm.language_code.
553
- class LanguageCodePair; end
554
-
555
- # Used with equivalent term set glossaries.
556
- # @!attribute [rw] language_codes
557
- # @return [Array<String>]
558
- # The BCP-47 language code(s) for terms defined in the glossary.
559
- # All entries are unique. The list contains at least two entries.
560
- # Expected to be an exact match for GlossaryTerm.language_code.
561
- class LanguageCodesSet; end
562
- end
563
-
564
- # Request message for CreateGlossary.
565
- # @!attribute [rw] parent
566
- # @return [String]
567
- # Required. The project name.
568
- # @!attribute [rw] glossary
569
- # @return [Google::Cloud::Translate::V3::Glossary]
570
- # Required. The glossary to create.
571
- class CreateGlossaryRequest; end
572
-
573
- # Request message for GetGlossary.
574
- # @!attribute [rw] name
575
- # @return [String]
576
- # Required. The name of the glossary to retrieve.
577
- class GetGlossaryRequest; end
578
-
579
- # Request message for DeleteGlossary.
580
- # @!attribute [rw] name
581
- # @return [String]
582
- # Required. The name of the glossary to delete.
583
- class DeleteGlossaryRequest; end
584
-
585
- # Request message for ListGlossaries.
586
- # @!attribute [rw] parent
587
- # @return [String]
588
- # Required. The name of the project from which to list all of the glossaries.
589
- # @!attribute [rw] page_size
590
- # @return [Integer]
591
- # Optional. Requested page size. The server may return fewer glossaries than
592
- # requested. If unspecified, the server picks an appropriate default.
593
- # @!attribute [rw] page_token
594
- # @return [String]
595
- # Optional. A token identifying a page of results the server should return.
596
- # Typically, this is the value of [ListGlossariesResponse.next_page_token]
597
- # returned from the previous call to `ListGlossaries` method.
598
- # The first page is returned if `page_token`is empty or missing.
599
- # @!attribute [rw] filter
600
- # @return [String]
601
- # Optional. Filter specifying constraints of a list operation.
602
- # Filtering is not supported yet, and the parameter currently has no effect.
603
- # If missing, no filtering is performed.
604
- class ListGlossariesRequest; end
605
-
606
- # Response message for ListGlossaries.
607
- # @!attribute [rw] glossaries
608
- # @return [Array<Google::Cloud::Translate::V3::Glossary>]
609
- # The list of glossaries for a project.
610
- # @!attribute [rw] next_page_token
611
- # @return [String]
612
- # A token to retrieve a page of results. Pass this value in the
613
- # [ListGlossariesRequest.page_token] field in the subsequent call to
614
- # `ListGlossaries` method to retrieve the next page of results.
615
- class ListGlossariesResponse; end
616
-
617
- # Stored in the
618
- # {Google::Longrunning::Operation#metadata}
619
- # field returned by CreateGlossary.
620
- # @!attribute [rw] name
621
- # @return [String]
622
- # The name of the glossary that is being created.
623
- # @!attribute [rw] state
624
- # @return [Google::Cloud::Translate::V3::CreateGlossaryMetadata::State]
625
- # The current state of the glossary creation operation.
626
- # @!attribute [rw] submit_time
627
- # @return [Google::Protobuf::Timestamp]
628
- # The time when the operation was submitted to the server.
629
- class CreateGlossaryMetadata; end
630
-
631
- # Stored in the
632
- # {Google::Longrunning::Operation#metadata}
633
- # field returned by DeleteGlossary.
634
- # @!attribute [rw] name
635
- # @return [String]
636
- # The name of the glossary that is being deleted.
637
- # @!attribute [rw] state
638
- # @return [Google::Cloud::Translate::V3::DeleteGlossaryMetadata::State]
639
- # The current state of the glossary deletion operation.
640
- # @!attribute [rw] submit_time
641
- # @return [Google::Protobuf::Timestamp]
642
- # The time when the operation was submitted to the server.
643
- class DeleteGlossaryMetadata; end
644
-
645
- # Stored in the
646
- # {Google::Longrunning::Operation#response}
647
- # field returned by DeleteGlossary.
648
- # @!attribute [rw] name
649
- # @return [String]
650
- # The name of the deleted glossary.
651
- # @!attribute [rw] submit_time
652
- # @return [Google::Protobuf::Timestamp]
653
- # The time when the operation was submitted to the server.
654
- # @!attribute [rw] end_time
655
- # @return [Google::Protobuf::Timestamp]
656
- # The time when the glossary deletion is finished and
657
- # {Google::Longrunning::Operation#done} is
658
- # set to true.
659
- class DeleteGlossaryResponse; end
660
- end
661
- end
662
- end
663
- end