From b9c09e31a08a43bfa1049465aa7633c73ea91fc0 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 21 Feb 2023 21:23:22 -0800 Subject: [PATCH] feat: [translate] Add supported fields in document translation request and refresh translation v3 GA service proto documentation (#4007) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Add supported fields in document translation request and refresh translation v3 GA service proto documentation PiperOrigin-RevId: 511225850 Source-Link: https://github.com/googleapis/googleapis/commit/84bbbc5438fbb7aaefa04447f37e91ff3a38a2f0 Source-Link: https://github.com/googleapis/googleapis-gen/commit/431d15cddae84906d4ac2e1d75e243099747c52b Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXRyYW5zbGF0ZS8uT3dsQm90LnlhbWwiLCJoIjoiNDMxZDE1Y2RkYWU4NDkwNmQ0YWMyZTFkNzVlMjQzMDk5NzQ3YzUyYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot Co-authored-by: Daniel Bankhead --- .../translate/v3/translation_service.proto | 88 +++++++++----- .../google-cloud-translate/protos/protos.d.ts | 30 +++++ .../google-cloud-translate/protos/protos.js | 115 ++++++++++++++++++ .../google-cloud-translate/protos/protos.json | 35 ++++++ ..._metadata.google.cloud.translation.v3.json | 24 +++- ...lation_service.batch_translate_document.js | 11 +- .../translation_service.translate_document.js | 23 +++- .../v3/translation_service.translate_text.js | 9 +- ...data.google.cloud.translation.v3beta1.json | 2 +- .../src/v3/translation_service_client.ts | 37 ++++-- 10 files changed, 319 insertions(+), 55 deletions(-) diff --git a/packages/google-cloud-translate/protos/google/cloud/translate/v3/translation_service.proto b/packages/google-cloud-translate/protos/google/cloud/translate/v3/translation_service.proto index b63b233c028..d5e93176aa7 100644 --- a/packages/google-cloud-translate/protos/google/cloud/translate/v3/translation_service.proto +++ b/packages/google-cloud-translate/protos/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. @@ -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]; @@ -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. @@ -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; @@ -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; } @@ -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]` @@ -696,7 +695,7 @@ 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 @@ -704,7 +703,7 @@ message TranslateDocumentRequest { // 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]; @@ -751,6 +750,24 @@ message TranslateDocumentRequest { // See https://cloud.google.com/translate/docs/advanced/labels for more // information. map 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. @@ -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. @@ -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" @@ -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; @@ -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. @@ -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]; @@ -1267,6 +1287,12 @@ message BatchTranslateDocumentRequest { // original file. map 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. @@ -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`: diff --git a/packages/google-cloud-translate/protos/protos.d.ts b/packages/google-cloud-translate/protos/protos.d.ts index 15dbdecdad3..b1a43567854 100644 --- a/packages/google-cloud-translate/protos/protos.d.ts +++ b/packages/google-cloud-translate/protos/protos.d.ts @@ -2009,6 +2009,15 @@ export namespace google { /** TranslateDocumentRequest labels */ labels?: ({ [k: string]: string }|null); + + /** TranslateDocumentRequest customizedAttribution */ + customizedAttribution?: (string|null); + + /** TranslateDocumentRequest isTranslateNativePdfOnly */ + isTranslateNativePdfOnly?: (boolean|null); + + /** TranslateDocumentRequest enableShadowRemovalNativePdf */ + enableShadowRemovalNativePdf?: (boolean|null); } /** Represents a TranslateDocumentRequest. */ @@ -2044,6 +2053,15 @@ export namespace google { /** TranslateDocumentRequest labels. */ public labels: { [k: string]: string }; + /** TranslateDocumentRequest customizedAttribution. */ + public customizedAttribution: string; + + /** TranslateDocumentRequest isTranslateNativePdfOnly. */ + public isTranslateNativePdfOnly: boolean; + + /** TranslateDocumentRequest enableShadowRemovalNativePdf. */ + public enableShadowRemovalNativePdf: boolean; + /** * Creates a new TranslateDocumentRequest instance using the specified properties. * @param [properties] Properties to set @@ -2863,6 +2881,9 @@ export namespace google { /** Glossary endTime */ endTime?: (google.protobuf.ITimestamp|null); + + /** Glossary displayName */ + displayName?: (string|null); } /** Represents a Glossary. */ @@ -2895,6 +2916,9 @@ export namespace google { /** Glossary endTime. */ public endTime?: (google.protobuf.ITimestamp|null); + /** Glossary displayName. */ + public displayName: string; + /** Glossary languages. */ public languages?: ("languagePair"|"languageCodesSet"); @@ -4073,6 +4097,9 @@ export namespace google { /** BatchTranslateDocumentRequest formatConversions */ formatConversions?: ({ [k: string]: string }|null); + + /** BatchTranslateDocumentRequest customizedAttribution */ + customizedAttribution?: (string|null); } /** Represents a BatchTranslateDocumentRequest. */ @@ -4108,6 +4135,9 @@ export namespace google { /** BatchTranslateDocumentRequest formatConversions. */ public formatConversions: { [k: string]: string }; + /** BatchTranslateDocumentRequest customizedAttribution. */ + public customizedAttribution: string; + /** * Creates a new BatchTranslateDocumentRequest instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-cloud-translate/protos/protos.js b/packages/google-cloud-translate/protos/protos.js index 21a9e0a8b66..10c70261f31 100644 --- a/packages/google-cloud-translate/protos/protos.js +++ b/packages/google-cloud-translate/protos/protos.js @@ -4609,6 +4609,9 @@ * @property {string|null} [model] TranslateDocumentRequest model * @property {google.cloud.translation.v3.ITranslateTextGlossaryConfig|null} [glossaryConfig] TranslateDocumentRequest glossaryConfig * @property {Object.|null} [labels] TranslateDocumentRequest labels + * @property {string|null} [customizedAttribution] TranslateDocumentRequest customizedAttribution + * @property {boolean|null} [isTranslateNativePdfOnly] TranslateDocumentRequest isTranslateNativePdfOnly + * @property {boolean|null} [enableShadowRemovalNativePdf] TranslateDocumentRequest enableShadowRemovalNativePdf */ /** @@ -4691,6 +4694,30 @@ */ TranslateDocumentRequest.prototype.labels = $util.emptyObject; + /** + * TranslateDocumentRequest customizedAttribution. + * @member {string} customizedAttribution + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @instance + */ + TranslateDocumentRequest.prototype.customizedAttribution = ""; + + /** + * TranslateDocumentRequest isTranslateNativePdfOnly. + * @member {boolean} isTranslateNativePdfOnly + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @instance + */ + TranslateDocumentRequest.prototype.isTranslateNativePdfOnly = false; + + /** + * TranslateDocumentRequest enableShadowRemovalNativePdf. + * @member {boolean} enableShadowRemovalNativePdf + * @memberof google.cloud.translation.v3.TranslateDocumentRequest + * @instance + */ + TranslateDocumentRequest.prototype.enableShadowRemovalNativePdf = false; + /** * Creates a new TranslateDocumentRequest instance using the specified properties. * @function create @@ -4732,6 +4759,12 @@ if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.customizedAttribution != null && Object.hasOwnProperty.call(message, "customizedAttribution")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.customizedAttribution); + if (message.isTranslateNativePdfOnly != null && Object.hasOwnProperty.call(message, "isTranslateNativePdfOnly")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.isTranslateNativePdfOnly); + if (message.enableShadowRemovalNativePdf != null && Object.hasOwnProperty.call(message, "enableShadowRemovalNativePdf")) + writer.uint32(/* id 12, wireType 0 =*/96).bool(message.enableShadowRemovalNativePdf); return writer; }; @@ -4817,6 +4850,18 @@ message.labels[key] = value; break; } + case 10: { + message.customizedAttribution = reader.string(); + break; + } + case 11: { + message.isTranslateNativePdfOnly = reader.bool(); + break; + } + case 12: { + message.enableShadowRemovalNativePdf = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -4887,6 +4932,15 @@ if (!$util.isString(message.labels[key[i]])) return "labels: string{k:string} expected"; } + if (message.customizedAttribution != null && message.hasOwnProperty("customizedAttribution")) + if (!$util.isString(message.customizedAttribution)) + return "customizedAttribution: string expected"; + if (message.isTranslateNativePdfOnly != null && message.hasOwnProperty("isTranslateNativePdfOnly")) + if (typeof message.isTranslateNativePdfOnly !== "boolean") + return "isTranslateNativePdfOnly: boolean expected"; + if (message.enableShadowRemovalNativePdf != null && message.hasOwnProperty("enableShadowRemovalNativePdf")) + if (typeof message.enableShadowRemovalNativePdf !== "boolean") + return "enableShadowRemovalNativePdf: boolean expected"; return null; }; @@ -4932,6 +4986,12 @@ for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) message.labels[keys[i]] = String(object.labels[keys[i]]); } + if (object.customizedAttribution != null) + message.customizedAttribution = String(object.customizedAttribution); + if (object.isTranslateNativePdfOnly != null) + message.isTranslateNativePdfOnly = Boolean(object.isTranslateNativePdfOnly); + if (object.enableShadowRemovalNativePdf != null) + message.enableShadowRemovalNativePdf = Boolean(object.enableShadowRemovalNativePdf); return message; }; @@ -4958,6 +5018,9 @@ object.documentOutputConfig = null; object.model = ""; object.glossaryConfig = null; + object.customizedAttribution = ""; + object.isTranslateNativePdfOnly = false; + object.enableShadowRemovalNativePdf = false; } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; @@ -4979,6 +5042,12 @@ for (var j = 0; j < keys2.length; ++j) object.labels[keys2[j]] = message.labels[keys2[j]]; } + if (message.customizedAttribution != null && message.hasOwnProperty("customizedAttribution")) + object.customizedAttribution = message.customizedAttribution; + if (message.isTranslateNativePdfOnly != null && message.hasOwnProperty("isTranslateNativePdfOnly")) + object.isTranslateNativePdfOnly = message.isTranslateNativePdfOnly; + if (message.enableShadowRemovalNativePdf != null && message.hasOwnProperty("enableShadowRemovalNativePdf")) + object.enableShadowRemovalNativePdf = message.enableShadowRemovalNativePdf; return object; }; @@ -7082,6 +7151,7 @@ * @property {number|null} [entryCount] Glossary entryCount * @property {google.protobuf.ITimestamp|null} [submitTime] Glossary submitTime * @property {google.protobuf.ITimestamp|null} [endTime] Glossary endTime + * @property {string|null} [displayName] Glossary displayName */ /** @@ -7155,6 +7225,14 @@ */ Glossary.prototype.endTime = null; + /** + * Glossary displayName. + * @member {string} displayName + * @memberof google.cloud.translation.v3.Glossary + * @instance + */ + Glossary.prototype.displayName = ""; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -7207,6 +7285,8 @@ $root.google.protobuf.Timestamp.encode(message.submitTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.displayName); return writer; }; @@ -7269,6 +7349,10 @@ message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; } + case 9: { + message.displayName = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -7344,6 +7428,9 @@ if (error) return "endTime." + error; } + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; return null; }; @@ -7388,6 +7475,8 @@ throw TypeError(".google.cloud.translation.v3.Glossary.endTime: object expected"); message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); } + if (object.displayName != null) + message.displayName = String(object.displayName); return message; }; @@ -7410,6 +7499,7 @@ object.entryCount = 0; object.submitTime = null; object.endTime = null; + object.displayName = ""; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -7431,6 +7521,8 @@ object.submitTime = $root.google.protobuf.Timestamp.toObject(message.submitTime, options); if (message.endTime != null && message.hasOwnProperty("endTime")) object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; return object; }; @@ -9974,6 +10066,7 @@ * @property {Object.|null} [models] BatchTranslateDocumentRequest models * @property {Object.|null} [glossaries] BatchTranslateDocumentRequest glossaries * @property {Object.|null} [formatConversions] BatchTranslateDocumentRequest formatConversions + * @property {string|null} [customizedAttribution] BatchTranslateDocumentRequest customizedAttribution */ /** @@ -10060,6 +10153,14 @@ */ BatchTranslateDocumentRequest.prototype.formatConversions = $util.emptyObject; + /** + * BatchTranslateDocumentRequest customizedAttribution. + * @member {string} customizedAttribution + * @memberof google.cloud.translation.v3.BatchTranslateDocumentRequest + * @instance + */ + BatchTranslateDocumentRequest.prototype.customizedAttribution = ""; + /** * Creates a new BatchTranslateDocumentRequest instance using the specified properties. * @function create @@ -10107,6 +10208,8 @@ if (message.formatConversions != null && Object.hasOwnProperty.call(message, "formatConversions")) for (var keys = Object.keys(message.formatConversions), i = 0; i < keys.length; ++i) writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.formatConversions[keys[i]]).ldelim(); + if (message.customizedAttribution != null && Object.hasOwnProperty.call(message, "customizedAttribution")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.customizedAttribution); return writer; }; @@ -10234,6 +10337,10 @@ message.formatConversions[key] = value; break; } + case 10: { + message.customizedAttribution = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -10322,6 +10429,9 @@ if (!$util.isString(message.formatConversions[key[i]])) return "formatConversions: string{k:string} expected"; } + if (message.customizedAttribution != null && message.hasOwnProperty("customizedAttribution")) + if (!$util.isString(message.customizedAttribution)) + return "customizedAttribution: string expected"; return null; }; @@ -10387,6 +10497,8 @@ for (var keys = Object.keys(object.formatConversions), i = 0; i < keys.length; ++i) message.formatConversions[keys[i]] = String(object.formatConversions[keys[i]]); } + if (object.customizedAttribution != null) + message.customizedAttribution = String(object.customizedAttribution); return message; }; @@ -10416,6 +10528,7 @@ object.parent = ""; object.sourceLanguageCode = ""; object.outputConfig = null; + object.customizedAttribution = ""; } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; @@ -10449,6 +10562,8 @@ for (var j = 0; j < keys2.length; ++j) object.formatConversions[keys2[j]] = message.formatConversions[keys2[j]]; } + if (message.customizedAttribution != null && message.hasOwnProperty("customizedAttribution")) + object.customizedAttribution = message.customizedAttribution; return object; }; diff --git a/packages/google-cloud-translate/protos/protos.json b/packages/google-cloud-translate/protos/protos.json index 31dc9660290..ca4d1231447 100644 --- a/packages/google-cloud-translate/protos/protos.json +++ b/packages/google-cloud-translate/protos/protos.json @@ -663,6 +663,27 @@ "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "customizedAttribution": { + "type": "string", + "id": 10, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "isTranslateNativePdfOnly": { + "type": "bool", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "enableShadowRemovalNativePdf": { + "type": "bool", + "id": 12, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } } }, @@ -897,6 +918,13 @@ "options": { "(google.api.field_behavior)": "OUTPUT_ONLY" } + }, + "displayName": { + "type": "string", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } }, "nested": { @@ -1147,6 +1175,13 @@ "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "customizedAttribution": { + "type": "string", + "id": 10, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } } }, diff --git a/packages/google-cloud-translate/samples/generated/v3/snippet_metadata.google.cloud.translation.v3.json b/packages/google-cloud-translate/samples/generated/v3/snippet_metadata.google.cloud.translation.v3.json index e9c5dd46968..cce074cb254 100644 --- a/packages/google-cloud-translate/samples/generated/v3/snippet_metadata.google.cloud.translation.v3.json +++ b/packages/google-cloud-translate/samples/generated/v3/snippet_metadata.google.cloud.translation.v3.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-translation", - "version": "7.1.0", + "version": "7.1.1", "language": "TYPESCRIPT", "apis": [ { @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 118, + "end": 117, "type": "FULL" } ], @@ -194,7 +194,7 @@ "segments": [ { "start": 25, - "end": 115, + "end": 134, "type": "FULL" } ], @@ -234,6 +234,18 @@ { "name": "labels", "type": "TYPE_MESSAGE[]" + }, + { + "name": "customized_attribution", + "type": "TYPE_STRING" + }, + { + "name": "is_translate_native_pdf_only", + "type": "TYPE_BOOL" + }, + { + "name": "enable_shadow_removal_native_pdf", + "type": "TYPE_BOOL" } ], "resultType": ".google.cloud.translation.v3.TranslateDocumentResponse", @@ -330,7 +342,7 @@ "segments": [ { "start": 25, - "end": 115, + "end": 122, "type": "FULL" } ], @@ -370,6 +382,10 @@ { "name": "format_conversions", "type": "TYPE_MESSAGE[]" + }, + { + "name": "customized_attribution", + "type": "TYPE_STRING" } ], "resultType": ".google.longrunning.Operation", diff --git a/packages/google-cloud-translate/samples/generated/v3/translation_service.batch_translate_document.js b/packages/google-cloud-translate/samples/generated/v3/translation_service.batch_translate_document.js index 97b7b39de65..b2b587ac487 100644 --- a/packages/google-cloud-translate/samples/generated/v3/translation_service.batch_translate_document.js +++ b/packages/google-cloud-translate/samples/generated/v3/translation_service.batch_translate_document.js @@ -38,13 +38,13 @@ function main(parent, sourceLanguageCode, targetLanguageCodes, inputConfigs, out */ // const parent = 'abc123' /** - * 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). */ // const sourceLanguageCode = 'abc123' /** - * 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. */ // const targetLanguageCodes = 'abc123' @@ -89,6 +89,13 @@ function main(parent, sourceLanguageCode, targetLanguageCodes, inputConfigs, out * original file. */ // const formatConversions = 1234 + /** + * 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 + */ + // const customizedAttribution = 'abc123' // Imports the Translation library const {TranslationServiceClient} = require('@google-cloud/translate').v3; diff --git a/packages/google-cloud-translate/samples/generated/v3/translation_service.translate_document.js b/packages/google-cloud-translate/samples/generated/v3/translation_service.translate_document.js index 20ff935da55..69445cef518 100644 --- a/packages/google-cloud-translate/samples/generated/v3/translation_service.translate_document.js +++ b/packages/google-cloud-translate/samples/generated/v3/translation_service.translate_document.js @@ -40,7 +40,7 @@ function main(parent, targetLanguageCode, documentInputConfig) { */ // const parent = 'abc123' /** - * 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 @@ -49,7 +49,7 @@ function main(parent, targetLanguageCode, documentInputConfig) { */ // const sourceLanguageCode = 'abc123' /** - * 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. */ // const targetLanguageCode = 'abc123' @@ -92,6 +92,25 @@ function main(parent, targetLanguageCode, documentInputConfig) { * information. */ // const labels = 1234 + /** + * 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 + */ + // const customizedAttribution = 'abc123' + /** + * Optional. If true, the page limit of online native pdf translation is 300 + * and only native pdf pages will be translated. + */ + // const isTranslateNativePdfOnly = true + /** + * 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 + */ + // const enableShadowRemovalNativePdf = true // Imports the Translation library const {TranslationServiceClient} = require('@google-cloud/translate').v3; diff --git a/packages/google-cloud-translate/samples/generated/v3/translation_service.translate_text.js b/packages/google-cloud-translate/samples/generated/v3/translation_service.translate_text.js index 6575fbbb9d7..9d2ffd9d05f 100644 --- a/packages/google-cloud-translate/samples/generated/v3/translation_service.translate_text.js +++ b/packages/google-cloud-translate/samples/generated/v3/translation_service.translate_text.js @@ -30,9 +30,8 @@ function main(contents, targetLanguageCode, parent) { */ /** * 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. */ // const contents = 'abc123' /** @@ -41,7 +40,7 @@ function main(contents, targetLanguageCode, parent) { */ // const mimeType = 'abc123' /** - * 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 @@ -49,7 +48,7 @@ function main(contents, targetLanguageCode, parent) { */ // const sourceLanguageCode = 'abc123' /** - * 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. */ // const targetLanguageCode = 'abc123' diff --git a/packages/google-cloud-translate/samples/generated/v3beta1/snippet_metadata.google.cloud.translation.v3beta1.json b/packages/google-cloud-translate/samples/generated/v3beta1/snippet_metadata.google.cloud.translation.v3beta1.json index be715c10f9d..d8b3f5058ba 100644 --- a/packages/google-cloud-translate/samples/generated/v3beta1/snippet_metadata.google.cloud.translation.v3beta1.json +++ b/packages/google-cloud-translate/samples/generated/v3beta1/snippet_metadata.google.cloud.translation.v3beta1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-translation", - "version": "7.1.0", + "version": "7.1.1", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-translate/src/v3/translation_service_client.ts b/packages/google-cloud-translate/src/v3/translation_service_client.ts index 858e4c44262..99fbee530cb 100644 --- a/packages/google-cloud-translate/src/v3/translation_service_client.ts +++ b/packages/google-cloud-translate/src/v3/translation_service_client.ts @@ -454,20 +454,19 @@ export class TranslationServiceClient { * The request object that will be sent. * @param {string[]} request.contents * 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. * @param {string} [request.mimeType] * Optional. The format of the source text, for example, "text/html", * "text/plain". If left blank, the MIME type defaults to "text/html". * @param {string} [request.sourceLanguageCode] - * 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. * @param {string} request.targetLanguageCode - * 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. * @param {string} request.parent * Required. Project or location to make a call. Must refer to a caller's @@ -871,14 +870,14 @@ export class TranslationServiceClient { * Models and glossaries must be within the same region (have the same * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. * @param {string} [request.sourceLanguageCode] - * 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. * @param {string} request.targetLanguageCode - * 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. * @param {google.cloud.translation.v3.DocumentInputConfig} request.documentInputConfig * Required. Input configurations. @@ -916,6 +915,19 @@ export class TranslationServiceClient { * * See https://cloud.google.com/translate/docs/advanced/labels for more * information. + * @param {string} [request.customizedAttribution] + * 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 + * @param {boolean} [request.isTranslateNativePdfOnly] + * Optional. If true, the page limit of online native pdf translation is 300 + * and only native pdf pages will be translated. + * @param {boolean} [request.enableShadowRemovalNativePdf] + * 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 * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -1303,11 +1315,11 @@ export class TranslationServiceClient { * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) * error is returned. * @param {string} request.sourceLanguageCode - * 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). * @param {string[]} request.targetLanguageCodes - * 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. * @param {number[]} request.inputConfigs * Required. Input configurations. @@ -1347,6 +1359,11 @@ export class TranslationServiceClient { * * If nothing specified, output files will be in the same format as the * original file. + * @param {string} [request.customizedAttribution] + * 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 * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array.