Skip to content

Commit

Permalink
feat: Add supported fields in document translation request and refres…
Browse files Browse the repository at this point in the history
…h translation v3 GA service proto documentation

PiperOrigin-RevId: 511225850
  • Loading branch information
Google APIs authored and Copybara-Service committed Feb 21, 2023
1 parent af2f5da commit 84bbbc5
Showing 1 changed file with 57 additions and 31 deletions.
88 changes: 57 additions & 31 deletions google/cloud/translate/v3/translation_service.proto
@@ -1,4 +1,4 @@
// Copyright 2021 Google LLC
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -183,37 +183,36 @@ service TranslationService {
message TranslateTextGlossaryConfig {
// Required. The `glossary` to be applied for this translation.
//
// The format depends on glossary:
// The format depends on the glossary:
//
// - User provided custom glossary:
// - User-provided custom glossary:
// `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`
string glossary = 1 [(google.api.field_behavior) = REQUIRED];

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

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

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

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

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

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

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

// The response message for language detection.
message DetectedLanguage {
// The BCP-47 language code of source content in the request, detected
// The ISO-639 language code of the source content in the request, detected
// automatically.
string language_code = 1;

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

// Human readable name of the language localized in the display language
// Human-readable name of the language localized in the display language
// specified in the request.
string display_name = 2;

// Can be used as source language.
// Can be used as a source language.
bool support_source = 3;

// Can be used as target language.
// Can be used as a target language.
bool support_target = 4;
}

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

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

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

Expand Down Expand Up @@ -751,6 +750,24 @@ message TranslateDocumentRequest {
// See https://cloud.google.com/translate/docs/advanced/labels for more
// information.
map<string, string> labels = 8 [(google.api.field_behavior) = OPTIONAL];

// Optional. This flag is to support user customized attribution.
// If not provided, the default is `Machine Translated by Google`.
// Customized attribution should follow rules in
// https://cloud.google.com/translate/attribution#attribution_and_logos
string customized_attribution = 10 [(google.api.field_behavior) = OPTIONAL];

// Optional. If true, the page limit of online native pdf translation is 300
// and only native pdf pages will be translated.
bool is_translate_native_pdf_only = 11
[(google.api.field_behavior) = OPTIONAL];

// Optional. If true, use the text removal to remove the shadow text on
// background image for native pdf translation.
// Shadow removal feature can only be enabled when
// is_translate_native_pdf_only is false
bool enable_shadow_removal_native_pdf = 12
[(google.api.field_behavior) = OPTIONAL];
}

// A translated document message.
Expand Down Expand Up @@ -947,10 +964,10 @@ message GlossaryInputConfig {
//
// For unidirectional glossaries:
//
// - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated.
// - TSV/CSV (`.tsv`/`.csv`): Two column file, tab- or comma-separated.
// The first column is source text. The second column is target text.
// The file must not contain headers. That is, the first row is data, not
// column names.
// No headers in this file. The first row contains data and not column
// names.
//
// - TMX (`.tmx`): TMX file with parallel data defining source/target term
// pairs.
Expand All @@ -964,7 +981,7 @@ message GlossaryInputConfig {
}
}

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

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

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

// Used with equivalent term set glossaries.
message LanguageCodesSet {
// The BCP-47 language code(s) for terms defined in the glossary.
// The ISO-639 language code(s) for terms defined in the glossary.
// All entries are unique. The list contains at least two entries.
// Expected to be an exact match for GlossaryTerm.language_code.
repeated string language_codes = 1;
Expand Down Expand Up @@ -1017,6 +1034,9 @@ message Glossary {
// Output only. When the glossary creation was finished.
google.protobuf.Timestamp end_time = 8
[(google.api.field_behavior) = OUTPUT_ONLY];

// Optional. The display name of the glossary.
string display_name = 9 [(google.api.field_behavior) = OPTIONAL];
}

// Request message for CreateGlossary.
Expand Down Expand Up @@ -1211,12 +1231,12 @@ message BatchTranslateDocumentRequest {
}
];

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

// Required. The BCP-47 language code to use for translation of the input
// Required. The ISO-639 language code to use for translation of the input
// document. Specify up to 10 language codes here.
repeated string target_language_codes = 3
[(google.api.field_behavior) = REQUIRED];
Expand Down Expand Up @@ -1267,6 +1287,12 @@ message BatchTranslateDocumentRequest {
// original file.
map<string, string> format_conversions = 8
[(google.api.field_behavior) = OPTIONAL];

// Optional. This flag is to support user customized attribution.
// If not provided, the default is `Machine Translated by Google`.
// Customized attribution should follow rules in
// https://cloud.google.com/translate/attribution#attribution_and_logos
string customized_attribution = 10 [(google.api.field_behavior) = OPTIONAL];
}

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

0 comments on commit 84bbbc5

Please sign in to comment.