Skip to content

Commit baf7775

Browse files
Google APIscopybara-github
authored andcommitted
feat: Adds support for RefineText
feat: Adds option for contextual translation with glossaries feat: Adds option for pdf_native only document translation PiperOrigin-RevId: 828181593
1 parent 53af3b7 commit baf7775

File tree

1 file changed

+67
-1
lines changed

1 file changed

+67
-1
lines changed

google/cloud/translate/v3beta1/translation_service.proto

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,14 @@ service TranslationService {
173173
metadata_type: "DeleteGlossaryMetadata"
174174
};
175175
}
176+
177+
// Refines the input translated text to improve the quality.
178+
rpc RefineText(RefineTextRequest) returns (RefineTextResponse) {
179+
option (google.api.http) = {
180+
post: "/v3beta1/{parent=projects/*/locations/*}:refineText"
181+
body: "*"
182+
};
183+
}
176184
}
177185

178186
// Configures which glossary should be used for a specific target language,
@@ -185,6 +193,11 @@ message TranslateTextGlossaryConfig {
185193
// Optional. Indicates match is case-insensitive.
186194
// Default value is false if missing.
187195
bool ignore_case = 2 [(google.api.field_behavior) = OPTIONAL];
196+
197+
// Optional. If set to true, the glossary will be used for contextual
198+
// translation.
199+
bool contextual_translation_enabled = 4
200+
[(google.api.field_behavior) = OPTIONAL];
188201
}
189202

190203
// The request message for synchronous translation.
@@ -684,7 +697,12 @@ message TranslateDocumentRequest {
684697
//
685698
// Models and glossaries must be within the same region (have the same
686699
// location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
687-
string parent = 1 [(google.api.field_behavior) = REQUIRED];
700+
string parent = 1 [
701+
(google.api.field_behavior) = REQUIRED,
702+
(google.api.resource_reference) = {
703+
type: "locations.googleapis.com/Location"
704+
}
705+
];
688706

689707
// Optional. The BCP-47 language code of the input document if known, for
690708
// example, "en-US" or "sr-Latn". Supported language codes are listed in
@@ -1302,6 +1320,9 @@ message BatchTranslateDocumentRequest {
13021320

13031321
// Optional. If true, enable auto rotation correction in DVS.
13041322
bool enable_rotation_correction = 12 [(google.api.field_behavior) = OPTIONAL];
1323+
1324+
// Optional. If true, only native pdf pages will be translated.
1325+
bool pdf_native_only = 13 [(google.api.field_behavior) = OPTIONAL];
13051326
}
13061327

13071328
// Input configuration for BatchTranslateDocument request.
@@ -1493,3 +1514,48 @@ message BatchTranslateDocumentMetadata {
14931514
// Time when the operation was submitted.
14941515
google.protobuf.Timestamp submit_time = 10;
14951516
}
1517+
1518+
// A single refinement entry for RefineTextRequest.
1519+
message RefinementEntry {
1520+
// Required. The source text to be refined.
1521+
string source_text = 1 [(google.api.field_behavior) = REQUIRED];
1522+
1523+
// Required. The original translation of the source text.
1524+
string original_translation = 2 [(google.api.field_behavior) = REQUIRED];
1525+
}
1526+
1527+
// Request message for RefineText.
1528+
message RefineTextRequest {
1529+
// Required. Project or location to make a call. Must refer to a caller's
1530+
// project.
1531+
//
1532+
// Format: `projects/{project-number-or-id}/locations/{location-id}`.
1533+
//
1534+
// For global calls, use `projects/{project-number-or-id}/locations/global` or
1535+
// `projects/{project-number-or-id}`.
1536+
string parent = 1 [
1537+
(google.api.field_behavior) = REQUIRED,
1538+
(google.api.resource_reference) = {
1539+
type: "locations.googleapis.com/Location"
1540+
}
1541+
];
1542+
1543+
// Required. The source texts and original translations in the source and
1544+
// target languages.
1545+
repeated RefinementEntry refinement_entries = 2
1546+
[(google.api.field_behavior) = REQUIRED];
1547+
1548+
// Required. The BCP-47 language code of the source text in the request, for
1549+
// example, "en-US".
1550+
string source_language_code = 4 [(google.api.field_behavior) = REQUIRED];
1551+
1552+
// Required. The BCP-47 language code for translation output, for example,
1553+
// "zh-CN".
1554+
string target_language_code = 5 [(google.api.field_behavior) = REQUIRED];
1555+
}
1556+
1557+
// Response message for RefineText.
1558+
message RefineTextResponse {
1559+
// The refined translations obtained from the original translations.
1560+
repeated string refined_translations = 1;
1561+
}

0 commit comments

Comments
 (0)