Skip to content

Commit 84bbbc5

Browse files
Google APIscopybara-github
authored andcommitted
feat: Add supported fields in document translation request and refresh translation v3 GA service proto documentation
PiperOrigin-RevId: 511225850
1 parent af2f5da commit 84bbbc5

1 file changed

Lines changed: 57 additions & 31 deletions

File tree

google/cloud/translate/v3/translation_service.proto

Lines changed: 57 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021 Google LLC
1+
// Copyright 2022 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -183,37 +183,36 @@ service TranslationService {
183183
message TranslateTextGlossaryConfig {
184184
// Required. The `glossary` to be applied for this translation.
185185
//
186-
// The format depends on glossary:
186+
// The format depends on the glossary:
187187
//
188-
// - User provided custom glossary:
188+
// - User-provided custom glossary:
189189
// `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`
190190
string glossary = 1 [(google.api.field_behavior) = REQUIRED];
191191

192-
// Optional. Indicates match is case-insensitive.
193-
// Default value is false if missing.
192+
// Optional. Indicates match is case insensitive. The default value is `false`
193+
// if missing.
194194
bool ignore_case = 2 [(google.api.field_behavior) = OPTIONAL];
195195
}
196196

197197
// The request message for synchronous translation.
198198
message TranslateTextRequest {
199199
// Required. The content of the input in string format.
200-
// We recommend the total content be less than 30k codepoints. The max length
201-
// of this field is 1024.
202-
// Use BatchTranslateText for larger text.
200+
// We recommend the total content be less than 30,000 codepoints. The max
201+
// length of this field is 1024. Use BatchTranslateText for larger text.
203202
repeated string contents = 1 [(google.api.field_behavior) = REQUIRED];
204203

205204
// Optional. The format of the source text, for example, "text/html",
206205
// "text/plain". If left blank, the MIME type defaults to "text/html".
207206
string mime_type = 3 [(google.api.field_behavior) = OPTIONAL];
208207

209-
// Optional. The BCP-47 language code of the input text if
208+
// Optional. The ISO-639 language code of the input text if
210209
// known, for example, "en-US" or "sr-Latn". Supported language codes are
211210
// listed in Language Support. If the source language isn't specified, the API
212211
// attempts to identify the source language automatically and returns the
213212
// source language within the response.
214213
string source_language_code = 4 [(google.api.field_behavior) = OPTIONAL];
215214

216-
// Required. The BCP-47 language code to use for translation of the input
215+
// Required. The ISO-639 language code to use for translation of the input
217216
// text, set to one of the language codes listed in Language Support.
218217
string target_language_code = 5 [(google.api.field_behavior) = REQUIRED];
219218

@@ -305,7 +304,7 @@ message Translation {
305304
// `projects/{project-number}/locations/{location-id}/models/general/nmt`.
306305
string model = 2;
307306

308-
// The BCP-47 language code of source text in the initial request, detected
307+
// The ISO-639 language code of source text in the initial request, detected
309308
// automatically, if no source language was passed within the initial
310309
// request. If the source language was passed, auto-detection of the language
311310
// does not occur and this field is empty.
@@ -370,7 +369,7 @@ message DetectLanguageRequest {
370369

371370
// The response message for language detection.
372371
message DetectedLanguage {
373-
// The BCP-47 language code of source content in the request, detected
372+
// The ISO-639 language code of the source content in the request, detected
374373
// automatically.
375374
string language_code = 1;
376375

@@ -439,19 +438,19 @@ message SupportedLanguages {
439438
// to one supported language.
440439
message SupportedLanguage {
441440
// Supported language code, generally consisting of its ISO 639-1
442-
// identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes
441+
// identifier, for example, 'en', 'ja'. In certain cases, ISO-639 codes
443442
// including language and region identifiers are returned (for example,
444-
// 'zh-TW' and 'zh-CN')
443+
// 'zh-TW' and 'zh-CN').
445444
string language_code = 1;
446445

447-
// Human readable name of the language localized in the display language
446+
// Human-readable name of the language localized in the display language
448447
// specified in the request.
449448
string display_name = 2;
450449

451-
// Can be used as source language.
450+
// Can be used as a source language.
452451
bool support_source = 3;
453452

454-
// Can be used as target language.
453+
// Can be used as a target language.
455454
bool support_target = 4;
456455
}
457456

@@ -542,7 +541,7 @@ message OutputConfig {
542541
// Since index.csv will be keeping updated during the process, please make
543542
// sure there is no custom retention policy applied on the output bucket
544543
// that may avoid file updating.
545-
// (https://cloud.google.com/storage/docs/bucket-lock?hl=en#retention-policy)
544+
// (https://cloud.google.com/storage/docs/bucket-lock#retention-policy)
546545
//
547546
// The format of translations_file (for target language code 'trg') is:
548547
// `gs://translation_test/a_b_c_'trg'_translations.[extension]`
@@ -696,15 +695,15 @@ message TranslateDocumentRequest {
696695
// location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
697696
string parent = 1 [(google.api.field_behavior) = REQUIRED];
698697

699-
// Optional. The BCP-47 language code of the input document if known, for
698+
// Optional. The ISO-639 language code of the input document if known, for
700699
// example, "en-US" or "sr-Latn". Supported language codes are listed in
701700
// Language Support. If the source language isn't specified, the API attempts
702701
// to identify the source language automatically and returns the source
703702
// language within the response. Source language must be specified if the
704703
// request contains a glossary or a custom model.
705704
string source_language_code = 2 [(google.api.field_behavior) = OPTIONAL];
706705

707-
// Required. The BCP-47 language code to use for translation of the input
706+
// Required. The ISO-639 language code to use for translation of the input
708707
// document, set to one of the language codes listed in Language Support.
709708
string target_language_code = 3 [(google.api.field_behavior) = REQUIRED];
710709

@@ -751,6 +750,24 @@ message TranslateDocumentRequest {
751750
// See https://cloud.google.com/translate/docs/advanced/labels for more
752751
// information.
753752
map<string, string> labels = 8 [(google.api.field_behavior) = OPTIONAL];
753+
754+
// Optional. This flag is to support user customized attribution.
755+
// If not provided, the default is `Machine Translated by Google`.
756+
// Customized attribution should follow rules in
757+
// https://cloud.google.com/translate/attribution#attribution_and_logos
758+
string customized_attribution = 10 [(google.api.field_behavior) = OPTIONAL];
759+
760+
// Optional. If true, the page limit of online native pdf translation is 300
761+
// and only native pdf pages will be translated.
762+
bool is_translate_native_pdf_only = 11
763+
[(google.api.field_behavior) = OPTIONAL];
764+
765+
// Optional. If true, use the text removal to remove the shadow text on
766+
// background image for native pdf translation.
767+
// Shadow removal feature can only be enabled when
768+
// is_translate_native_pdf_only is false
769+
bool enable_shadow_removal_native_pdf = 12
770+
[(google.api.field_behavior) = OPTIONAL];
754771
}
755772

756773
// A translated document message.
@@ -947,10 +964,10 @@ message GlossaryInputConfig {
947964
//
948965
// For unidirectional glossaries:
949966
//
950-
// - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated.
967+
// - TSV/CSV (`.tsv`/`.csv`): Two column file, tab- or comma-separated.
951968
// The first column is source text. The second column is target text.
952-
// The file must not contain headers. That is, the first row is data, not
953-
// column names.
969+
// No headers in this file. The first row contains data and not column
970+
// names.
954971
//
955972
// - TMX (`.tmx`): TMX file with parallel data defining source/target term
956973
// pairs.
@@ -964,7 +981,7 @@ message GlossaryInputConfig {
964981
}
965982
}
966983

967-
// Represents a glossary built from user provided data.
984+
// Represents a glossary built from user-provided data.
968985
message Glossary {
969986
option (google.api.resource) = {
970987
type: "translate.googleapis.com/Glossary"
@@ -973,18 +990,18 @@ message Glossary {
973990

974991
// Used with unidirectional glossaries.
975992
message LanguageCodePair {
976-
// Required. The BCP-47 language code of the input text, for example,
993+
// Required. The ISO-639 language code of the input text, for example,
977994
// "en-US". Expected to be an exact match for GlossaryTerm.language_code.
978995
string source_language_code = 1;
979996

980-
// Required. The BCP-47 language code for translation output, for example,
997+
// Required. The ISO-639 language code for translation output, for example,
981998
// "zh-CN". Expected to be an exact match for GlossaryTerm.language_code.
982999
string target_language_code = 2;
9831000
}
9841001

9851002
// Used with equivalent term set glossaries.
9861003
message LanguageCodesSet {
987-
// The BCP-47 language code(s) for terms defined in the glossary.
1004+
// The ISO-639 language code(s) for terms defined in the glossary.
9881005
// All entries are unique. The list contains at least two entries.
9891006
// Expected to be an exact match for GlossaryTerm.language_code.
9901007
repeated string language_codes = 1;
@@ -1017,6 +1034,9 @@ message Glossary {
10171034
// Output only. When the glossary creation was finished.
10181035
google.protobuf.Timestamp end_time = 8
10191036
[(google.api.field_behavior) = OUTPUT_ONLY];
1037+
1038+
// Optional. The display name of the glossary.
1039+
string display_name = 9 [(google.api.field_behavior) = OPTIONAL];
10201040
}
10211041

10221042
// Request message for CreateGlossary.
@@ -1211,12 +1231,12 @@ message BatchTranslateDocumentRequest {
12111231
}
12121232
];
12131233

1214-
// Required. The BCP-47 language code of the input document if known, for
1234+
// Required. The ISO-639 language code of the input document if known, for
12151235
// example, "en-US" or "sr-Latn". Supported language codes are listed in
1216-
// Language Support (https://cloud.google.com/translate/docs/languages).
1236+
// [Language Support](https://cloud.google.com/translate/docs/languages).
12171237
string source_language_code = 2 [(google.api.field_behavior) = REQUIRED];
12181238

1219-
// Required. The BCP-47 language code to use for translation of the input
1239+
// Required. The ISO-639 language code to use for translation of the input
12201240
// document. Specify up to 10 language codes here.
12211241
repeated string target_language_codes = 3
12221242
[(google.api.field_behavior) = REQUIRED];
@@ -1267,6 +1287,12 @@ message BatchTranslateDocumentRequest {
12671287
// original file.
12681288
map<string, string> format_conversions = 8
12691289
[(google.api.field_behavior) = OPTIONAL];
1290+
1291+
// Optional. This flag is to support user customized attribution.
1292+
// If not provided, the default is `Machine Translated by Google`.
1293+
// Customized attribution should follow rules in
1294+
// https://cloud.google.com/translate/attribution#attribution_and_logos
1295+
string customized_attribution = 10 [(google.api.field_behavior) = OPTIONAL];
12701296
}
12711297

12721298
// Input configuration for BatchTranslateDocument request.
@@ -1332,7 +1358,7 @@ message BatchDocumentOutputConfig {
13321358
// Since index.csv will be keeping updated during the process, please make
13331359
// sure there is no custom retention policy applied on the output bucket
13341360
// that may avoid file updating.
1335-
// (https://cloud.google.com/storage/docs/bucket-lock?hl=en#retention-policy)
1361+
// (https://cloud.google.com/storage/docs/bucket-lock#retention-policy)
13361362
//
13371363
// The naming format of translation output files follows (for target
13381364
// language code [trg]): `translation_output`:

0 commit comments

Comments
 (0)