blob: a4f9c245610fbe94eb44de2f3482bfd6eeee7c08 [file] [log] [blame]
Bu Sun Kim65020912020-05-20 12:08:20 -07001<html><body>
2<style>
3
4body, h1, h2, h3, div, span, p, pre, a {
5 margin: 0;
6 padding: 0;
7 border: 0;
8 font-weight: inherit;
9 font-style: inherit;
10 font-size: 100%;
11 font-family: inherit;
12 vertical-align: baseline;
13}
14
15body {
16 font-size: 13px;
17 padding: 1em;
18}
19
20h1 {
21 font-size: 26px;
22 margin-bottom: 1em;
23}
24
25h2 {
26 font-size: 24px;
27 margin-bottom: 1em;
28}
29
30h3 {
31 font-size: 20px;
32 margin-bottom: 1em;
33 margin-top: 1em;
34}
35
36pre, code {
37 line-height: 1.5;
38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42 margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46 font-family: Arial, sans serif;
47}
48
49h1, h2, h3 {
50 border-bottom: solid #CCC 1px;
51}
52
53.toc_element {
54 margin-top: 0.5em;
55}
56
57.firstline {
58 margin-left: 2 em;
59}
60
61.method {
62 margin-top: 1em;
63 border: solid 1px #CCC;
64 padding: 1em;
65 background: #EEE;
66}
67
68.details {
69 font-weight: bold;
70 font-size: 14px;
71}
72
73</style>
74
75<h1><a href="translate_v3.html">Cloud Translation API</a> . <a href="translate_v3.projects.html">projects</a> . <a href="translate_v3.projects.locations.html">locations</a></h1>
76<h2>Instance Methods</h2>
77<p class="toc_element">
78 <code><a href="translate_v3.projects.locations.glossaries.html">glossaries()</a></code>
79</p>
80<p class="firstline">Returns the glossaries Resource.</p>
81
82<p class="toc_element">
83 <code><a href="translate_v3.projects.locations.operations.html">operations()</a></code>
84</p>
85<p class="firstline">Returns the operations Resource.</p>
86
87<p class="toc_element">
88 <code><a href="#batchTranslateText">batchTranslateText(parent, body=None, x__xgafv=None)</a></code></p>
89<p class="firstline">Translates a large volume of text in asynchronous batch mode.</p>
90<p class="toc_element">
91 <code><a href="#detectLanguage">detectLanguage(parent, body=None, x__xgafv=None)</a></code></p>
92<p class="firstline">Detects the language of text within a request.</p>
93<p class="toc_element">
94 <code><a href="#get">get(name, x__xgafv=None)</a></code></p>
95<p class="firstline">Gets information about a location.</p>
96<p class="toc_element">
Bu Sun Kimd059ad82020-07-22 17:02:09 -070097 <code><a href="#getSupportedLanguages">getSupportedLanguages(parent, displayLanguageCode=None, model=None, x__xgafv=None)</a></code></p>
Bu Sun Kim65020912020-05-20 12:08:20 -070098<p class="firstline">Returns a list of supported languages for translation.</p>
99<p class="toc_element">
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700100 <code><a href="#list">list(name, pageSize=None, filter=None, pageToken=None, x__xgafv=None)</a></code></p>
Bu Sun Kim65020912020-05-20 12:08:20 -0700101<p class="firstline">Lists information about the supported locations for this service.</p>
102<p class="toc_element">
103 <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p>
104<p class="firstline">Retrieves the next page of results.</p>
105<p class="toc_element">
106 <code><a href="#translateText">translateText(parent, body=None, x__xgafv=None)</a></code></p>
107<p class="firstline">Translates input text and returns translated text.</p>
108<h3>Method Details</h3>
109<div class="method">
110 <code class="details" id="batchTranslateText">batchTranslateText(parent, body=None, x__xgafv=None)</code>
111 <pre>Translates a large volume of text in asynchronous batch mode.
112This function provides real-time output as the inputs are being processed.
113If caller cancels a request, the partial results (for an input file, it&#x27;s
114all or nothing) may still be available on the specified output location.
115
116This call returns immediately and you can
117use google.longrunning.Operation.name to poll the status of the call.
118
119Args:
120 parent: string, Required. Location to make a call. Must refer to a caller&#x27;s project.
121
122Format: `projects/{project-number-or-id}/locations/{location-id}`.
123
124The `global` location is not supported for batch translation.
125
126Only AutoML Translation models or glossaries within the same region (have
127the same location-id) can be used, otherwise an INVALID_ARGUMENT (400)
128error is returned. (required)
129 body: object, The request body.
130 The object takes the form of:
131
132{ # The batch translation request.
133 &quot;sourceLanguageCode&quot;: &quot;A String&quot;, # Required. Source language code.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700134 &quot;labels&quot;: { # Optional. The labels with user-defined metadata for the request.
135 #
136 # Label keys and values can be no longer than 63 characters
137 # (Unicode codepoints), can only contain lowercase letters, numeric
138 # characters, underscores and dashes. International characters are allowed.
139 # Label values are optional. Label keys must start with a letter.
140 #
141 # See https://cloud.google.com/translate/docs/advanced/labels for more
142 # information.
143 &quot;a_key&quot;: &quot;A String&quot;,
144 },
145 &quot;models&quot;: { # Optional. The models to use for translation. Map&#x27;s key is target language
146 # code. Map&#x27;s value is model name. Value can be a built-in general model,
147 # or an AutoML Translation model.
148 #
149 # The value format depends on model type:
150 #
151 # - AutoML Translation models:
152 # `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
153 #
154 # - General (built-in) models:
155 # `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
156 # `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
157 #
158 #
159 # If the map is empty or a specific model is
160 # not requested for a language pair, then default google model (nmt) is used.
161 &quot;a_key&quot;: &quot;A String&quot;,
162 },
163 &quot;glossaries&quot;: { # Optional. Glossaries to be applied for translation.
164 # It&#x27;s keyed by target language code.
165 &quot;a_key&quot;: { # Configures which glossary should be used for a specific target language,
166 # and defines options for applying that glossary.
167 &quot;glossary&quot;: &quot;A String&quot;, # Required. The `glossary` to be applied for this translation.
168 #
169 # The format depends on glossary:
170 #
171 # - User provided custom glossary:
172 # `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`
173 &quot;ignoreCase&quot;: True or False, # Optional. Indicates match is case-insensitive.
174 # Default value is false if missing.
175 },
176 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700177 &quot;outputConfig&quot;: { # Output configuration for BatchTranslateText request. # Required. Output configuration.
178 # If 2 input configs match to the same file (that is, same input path),
179 # we don&#x27;t generate output for duplicate inputs.
180 &quot;gcsDestination&quot;: { # The Google Cloud Storage location for the output content. # Google Cloud Storage destination for output content.
181 # For every single input file (for example, gs://a/b/c.[extension]), we
182 # generate at most 2 * n output files. (n is the # of target_language_codes
183 # in the BatchTranslateTextRequest).
184 #
185 # Output files (tsv) generated are compliant with RFC 4180 except that
186 # record delimiters are &#x27;\n&#x27; instead of &#x27;\r\n&#x27;. We don&#x27;t provide any way to
187 # change record delimiters.
188 #
189 # While the input files are being processed, we write/update an index file
190 # &#x27;index.csv&#x27; under &#x27;output_uri_prefix&#x27; (for example,
191 # gs://translation-test/index.csv) The index file is generated/updated as
192 # new files are being translated. The format is:
193 #
194 # input_file,target_language_code,translations_file,errors_file,
195 # glossary_translations_file,glossary_errors_file
196 #
197 # input_file is one file we matched using gcs_source.input_uri.
198 # target_language_code is provided in the request.
199 # translations_file contains the translations. (details provided below)
200 # errors_file contains the errors during processing of the file. (details
201 # below). Both translations_file and errors_file could be empty
202 # strings if we have no content to output.
203 # glossary_translations_file and glossary_errors_file are always empty
204 # strings if the input_file is tsv. They could also be empty if we have no
205 # content to output.
206 #
207 # Once a row is present in index.csv, the input/output matching never
208 # changes. Callers should also expect all the content in input_file are
209 # processed and ready to be consumed (that is, no partial output file is
210 # written).
211 #
212 # The format of translations_file (for target language code &#x27;trg&#x27;) is:
213 # gs://translation_test/a_b_c_&#x27;trg&#x27;_translations.[extension]
214 #
215 # If the input file extension is tsv, the output has the following
216 # columns:
217 # Column 1: ID of the request provided in the input, if it&#x27;s not
218 # provided in the input, then the input row number is used (0-based).
219 # Column 2: source sentence.
220 # Column 3: translation without applying a glossary. Empty string if there
221 # is an error.
222 # Column 4 (only present if a glossary is provided in the request):
223 # translation after applying the glossary. Empty string if there is an
224 # error applying the glossary. Could be same string as column 3 if there is
225 # no glossary applied.
226 #
227 # If input file extension is a txt or html, the translation is directly
228 # written to the output file. If glossary is requested, a separate
229 # glossary_translations_file has format of
230 # gs://translation_test/a_b_c_&#x27;trg&#x27;_glossary_translations.[extension]
231 #
232 # The format of errors file (for target language code &#x27;trg&#x27;) is:
233 # gs://translation_test/a_b_c_&#x27;trg&#x27;_errors.[extension]
234 #
235 # If the input file extension is tsv, errors_file contains the following:
236 # Column 1: ID of the request provided in the input, if it&#x27;s not
237 # provided in the input, then the input row number is used (0-based).
238 # Column 2: source sentence.
239 # Column 3: Error detail for the translation. Could be empty.
240 # Column 4 (only present if a glossary is provided in the request):
241 # Error when applying the glossary.
242 #
243 # If the input file extension is txt or html, glossary_error_file will be
244 # generated that contains error details. glossary_error_file has format of
245 # gs://translation_test/a_b_c_&#x27;trg&#x27;_glossary_errors.[extension]
246 &quot;outputUriPrefix&quot;: &quot;A String&quot;, # Required. The bucket used in &#x27;output_uri_prefix&#x27; must exist and there must be no
247 # files under &#x27;output_uri_prefix&#x27;. &#x27;output_uri_prefix&#x27; must end with &quot;/&quot; and
248 # start with &quot;gs://&quot;. One &#x27;output_uri_prefix&#x27; can only be used by one batch
249 # translation job at a time. Otherwise an INVALID_ARGUMENT (400) error is
250 # returned.
251 },
252 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700253 &quot;targetLanguageCodes&quot;: [ # Required. Specify up to 10 language codes here.
254 &quot;A String&quot;,
255 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700256 &quot;inputConfigs&quot;: [ # Required. Input configurations.
257 # The total number of files matched should be &lt;= 1000.
258 # The total content size should be &lt;= 100M Unicode codepoints.
259 # The files must use UTF-8 encoding.
260 { # Input configuration for BatchTranslateText request.
261 &quot;gcsSource&quot;: { # The Google Cloud Storage location for the input content. # Required. Google Cloud Storage location for the source input.
262 # This can be a single file (for example,
263 # `gs://translation-test/input.tsv`) or a wildcard (for example,
264 # `gs://translation-test/*`). If a file extension is `.tsv`, it can
265 # contain either one or two columns. The first column (optional) is the id
266 # of the text request. If the first column is missing, we use the row
267 # number (0-based) from the input file as the ID in the output file. The
268 # second column is the actual text to be
269 # translated. We recommend each row be &lt;= 10K Unicode codepoints,
270 # otherwise an error might be returned.
271 # Note that the input tsv must be RFC 4180 compliant.
272 #
273 # You could use https://github.com/Clever/csvlint to check potential
274 # formatting errors in your tsv file.
275 # csvlint --delimiter=&#x27;\t&#x27; your_input_file.tsv
276 #
277 # The other supported file extensions are `.txt` or `.html`, which is
278 # treated as a single large chunk of text.
279 &quot;inputUri&quot;: &quot;A String&quot;, # Required. Source data URI. For example, `gs://my_bucket/my_object`.
280 },
281 &quot;mimeType&quot;: &quot;A String&quot;, # Optional. Can be &quot;text/plain&quot; or &quot;text/html&quot;.
282 # For `.tsv`, &quot;text/html&quot; is used if mime_type is missing.
283 # For `.html`, this field must be &quot;text/html&quot; or empty.
284 # For `.txt`, this field must be &quot;text/plain&quot; or empty.
285 },
286 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700287 }
288
289 x__xgafv: string, V1 error format.
290 Allowed values
291 1 - v1 error format
292 2 - v2 error format
293
294Returns:
295 An object of the form:
296
297 { # This resource represents a long-running operation that is the result of a
298 # network API call.
Bu Sun Kim65020912020-05-20 12:08:20 -0700299 &quot;name&quot;: &quot;A String&quot;, # The server-assigned name, which is only unique within the same service that
300 # originally returns it. If you use the default HTTP mapping, the
301 # `name` should be a resource name ending with `operations/{unique_id}`.
302 &quot;error&quot;: { # The `Status` type defines a logical error model that is suitable for # The error result of the operation in case of failure or cancellation.
303 # different programming environments, including REST APIs and RPC APIs. It is
304 # used by [gRPC](https://github.com/grpc). Each `Status` message contains
305 # three pieces of data: error code, error message, and error details.
306 #
307 # You can find out more about this error model and how to work with it in the
308 # [API Design Guide](https://cloud.google.com/apis/design/errors).
309 &quot;code&quot;: 42, # The status code, which should be an enum value of google.rpc.Code.
310 &quot;message&quot;: &quot;A String&quot;, # A developer-facing error message, which should be in English. Any
311 # user-facing error message should be localized and sent in the
312 # google.rpc.Status.details field, or localized by the client.
313 &quot;details&quot;: [ # A list of messages that carry the error details. There is a common set of
314 # message types for APIs to use.
315 {
316 &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL.
317 },
318 ],
319 },
320 &quot;metadata&quot;: { # Service-specific metadata associated with the operation. It typically
321 # contains progress information and common metadata such as create time.
322 # Some services might not provide such metadata. Any method that returns a
323 # long-running operation should document the metadata type, if any.
324 &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL.
325 },
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700326 &quot;done&quot;: True or False, # If the value is `false`, it means the operation is still in progress.
327 # If `true`, the operation is completed, and either `error` or `response` is
328 # available.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700329 &quot;response&quot;: { # The normal response of the operation in case of success. If the original
330 # method returns no data on success, such as `Delete`, the response is
331 # `google.protobuf.Empty`. If the original method is standard
332 # `Get`/`Create`/`Update`, the response should be the resource. For other
333 # methods, the response should have the type `XxxResponse`, where `Xxx`
334 # is the original method name. For example, if the original method name
335 # is `TakeSnapshot()`, the inferred response type is
336 # `TakeSnapshotResponse`.
337 &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL.
338 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700339 }</pre>
340</div>
341
342<div class="method">
343 <code class="details" id="detectLanguage">detectLanguage(parent, body=None, x__xgafv=None)</code>
344 <pre>Detects the language of text within a request.
345
346Args:
347 parent: string, Required. Project or location to make a call. Must refer to a caller&#x27;s
348project.
349
350Format: `projects/{project-number-or-id}/locations/{location-id}` or
351`projects/{project-number-or-id}`.
352
353For global calls, use `projects/{project-number-or-id}/locations/global` or
354`projects/{project-number-or-id}`.
355
356Only models within the same region (has same location-id) can be used.
357Otherwise an INVALID_ARGUMENT (400) error is returned. (required)
358 body: object, The request body.
359 The object takes the form of:
360
361{ # The request message for language detection.
Bu Sun Kim65020912020-05-20 12:08:20 -0700362 &quot;labels&quot;: { # Optional. The labels with user-defined metadata for the request.
363 #
364 # Label keys and values can be no longer than 63 characters
365 # (Unicode codepoints), can only contain lowercase letters, numeric
366 # characters, underscores and dashes. International characters are allowed.
367 # Label values are optional. Label keys must start with a letter.
368 #
369 # See https://cloud.google.com/translate/docs/advanced/labels for more
370 # information.
371 &quot;a_key&quot;: &quot;A String&quot;,
372 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700373 &quot;content&quot;: &quot;A String&quot;, # The content of the input stored as a string.
374 &quot;mimeType&quot;: &quot;A String&quot;, # Optional. The format of the source text, for example, &quot;text/html&quot;,
375 # &quot;text/plain&quot;. If left blank, the MIME type defaults to &quot;text/html&quot;.
376 &quot;model&quot;: &quot;A String&quot;, # Optional. The language detection model to be used.
377 #
378 # Format:
379 # `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}`
380 #
381 # Only one language detection model is currently supported:
382 # `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`.
383 #
384 # If not specified, the default model is used.
Bu Sun Kim65020912020-05-20 12:08:20 -0700385 }
386
387 x__xgafv: string, V1 error format.
388 Allowed values
389 1 - v1 error format
390 2 - v2 error format
391
392Returns:
393 An object of the form:
394
395 { # The response message for language detection.
396 &quot;languages&quot;: [ # A list of detected languages sorted by detection confidence in descending
397 # order. The most probable language first.
398 { # The response message for language detection.
399 &quot;confidence&quot;: 3.14, # The confidence of the detection result for this language.
400 &quot;languageCode&quot;: &quot;A String&quot;, # The BCP-47 language code of source content in the request, detected
401 # automatically.
402 },
403 ],
404 }</pre>
405</div>
406
407<div class="method">
408 <code class="details" id="get">get(name, x__xgafv=None)</code>
409 <pre>Gets information about a location.
410
411Args:
412 name: string, Resource name for the location. (required)
413 x__xgafv: string, V1 error format.
414 Allowed values
415 1 - v1 error format
416 2 - v2 error format
417
418Returns:
419 An object of the form:
420
421 { # A resource that represents Google Cloud Platform location.
Bu Sun Kim65020912020-05-20 12:08:20 -0700422 &quot;displayName&quot;: &quot;A String&quot;, # The friendly name for this location, typically a nearby city name.
423 # For example, &quot;Tokyo&quot;.
Bu Sun Kim65020912020-05-20 12:08:20 -0700424 &quot;labels&quot;: { # Cross-service attributes for the location. For example
425 #
426 # {&quot;cloud.googleapis.com/region&quot;: &quot;us-east1&quot;}
427 &quot;a_key&quot;: &quot;A String&quot;,
428 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700429 &quot;locationId&quot;: &quot;A String&quot;, # The canonical id for this location. For example: `&quot;us-east1&quot;`.
430 &quot;metadata&quot;: { # Service-specific metadata. For example the available capacity at the given
431 # location.
432 &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL.
433 },
434 &quot;name&quot;: &quot;A String&quot;, # Resource name for the location, which may vary between implementations.
435 # For example: `&quot;projects/example-project/locations/us-east1&quot;`
Bu Sun Kim65020912020-05-20 12:08:20 -0700436 }</pre>
437</div>
438
439<div class="method">
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700440 <code class="details" id="getSupportedLanguages">getSupportedLanguages(parent, displayLanguageCode=None, model=None, x__xgafv=None)</code>
Bu Sun Kim65020912020-05-20 12:08:20 -0700441 <pre>Returns a list of supported languages for translation.
442
443Args:
444 parent: string, Required. Project or location to make a call. Must refer to a caller&#x27;s
445project.
446
447Format: `projects/{project-number-or-id}` or
448`projects/{project-number-or-id}/locations/{location-id}`.
449
450For global calls, use `projects/{project-number-or-id}/locations/global` or
451`projects/{project-number-or-id}`.
452
453Non-global location is required for AutoML models.
454
455Only models within the same region (have same location-id) can be used,
456otherwise an INVALID_ARGUMENT (400) error is returned. (required)
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700457 displayLanguageCode: string, Optional. The language to use to return localized, human readable names
458of supported languages. If missing, then display names are not returned
459in a response.
Bu Sun Kim65020912020-05-20 12:08:20 -0700460 model: string, Optional. Get supported languages of this model.
461
462The format depends on model type:
463
464- AutoML Translation models:
465 `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
466
467- General (built-in) models:
468 `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
469 `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
470
471
472Returns languages supported by the specified model.
473If missing, we get supported languages of Google general base (PBMT) model.
474 x__xgafv: string, V1 error format.
475 Allowed values
476 1 - v1 error format
477 2 - v2 error format
478
479Returns:
480 An object of the form:
481
482 { # The response message for discovering supported languages.
483 &quot;languages&quot;: [ # A list of supported language responses. This list contains an entry
484 # for each language the Translation API supports.
485 { # A single supported language response corresponds to information related
486 # to one supported language.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700487 &quot;displayName&quot;: &quot;A String&quot;, # Human readable name of the language localized in the display language
488 # specified in the request.
Bu Sun Kim65020912020-05-20 12:08:20 -0700489 &quot;languageCode&quot;: &quot;A String&quot;, # Supported language code, generally consisting of its ISO 639-1
490 # identifier, for example, &#x27;en&#x27;, &#x27;ja&#x27;. In certain cases, BCP-47 codes
491 # including language and region identifiers are returned (for example,
492 # &#x27;zh-TW&#x27; and &#x27;zh-CN&#x27;)
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700493 &quot;supportSource&quot;: True or False, # Can be used as source language.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700494 &quot;supportTarget&quot;: True or False, # Can be used as target language.
Bu Sun Kim65020912020-05-20 12:08:20 -0700495 },
496 ],
497 }</pre>
498</div>
499
500<div class="method">
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700501 <code class="details" id="list">list(name, pageSize=None, filter=None, pageToken=None, x__xgafv=None)</code>
Bu Sun Kim65020912020-05-20 12:08:20 -0700502 <pre>Lists information about the supported locations for this service.
503
504Args:
505 name: string, The resource that owns the locations collection, if applicable. (required)
Bu Sun Kim65020912020-05-20 12:08:20 -0700506 pageSize: integer, The standard list page size.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700507 filter: string, The standard list filter.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700508 pageToken: string, The standard list page token.
Bu Sun Kim65020912020-05-20 12:08:20 -0700509 x__xgafv: string, V1 error format.
510 Allowed values
511 1 - v1 error format
512 2 - v2 error format
513
514Returns:
515 An object of the form:
516
517 { # The response message for Locations.ListLocations.
518 &quot;nextPageToken&quot;: &quot;A String&quot;, # The standard List next-page token.
519 &quot;locations&quot;: [ # A list of locations that matches the specified filter in the request.
520 { # A resource that represents Google Cloud Platform location.
Bu Sun Kim65020912020-05-20 12:08:20 -0700521 &quot;displayName&quot;: &quot;A String&quot;, # The friendly name for this location, typically a nearby city name.
522 # For example, &quot;Tokyo&quot;.
Bu Sun Kim65020912020-05-20 12:08:20 -0700523 &quot;labels&quot;: { # Cross-service attributes for the location. For example
524 #
525 # {&quot;cloud.googleapis.com/region&quot;: &quot;us-east1&quot;}
526 &quot;a_key&quot;: &quot;A String&quot;,
527 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700528 &quot;locationId&quot;: &quot;A String&quot;, # The canonical id for this location. For example: `&quot;us-east1&quot;`.
529 &quot;metadata&quot;: { # Service-specific metadata. For example the available capacity at the given
530 # location.
531 &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL.
532 },
533 &quot;name&quot;: &quot;A String&quot;, # Resource name for the location, which may vary between implementations.
534 # For example: `&quot;projects/example-project/locations/us-east1&quot;`
Bu Sun Kim65020912020-05-20 12:08:20 -0700535 },
536 ],
537 }</pre>
538</div>
539
540<div class="method">
541 <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
542 <pre>Retrieves the next page of results.
543
544Args:
545 previous_request: The request for the previous page. (required)
546 previous_response: The response from the request for the previous page. (required)
547
548Returns:
549 A request object that you can call &#x27;execute()&#x27; on to request the next
550 page. Returns None if there are no more items in the collection.
551 </pre>
552</div>
553
554<div class="method">
555 <code class="details" id="translateText">translateText(parent, body=None, x__xgafv=None)</code>
556 <pre>Translates input text and returns translated text.
557
558Args:
559 parent: string, Required. Project or location to make a call. Must refer to a caller&#x27;s
560project.
561
562Format: `projects/{project-number-or-id}` or
563`projects/{project-number-or-id}/locations/{location-id}`.
564
565For global calls, use `projects/{project-number-or-id}/locations/global` or
566`projects/{project-number-or-id}`.
567
568Non-global location is required for requests using AutoML models or
569custom glossaries.
570
571Models and glossaries must be within the same region (have same
572location-id), otherwise an INVALID_ARGUMENT (400) error is returned. (required)
573 body: object, The request body.
574 The object takes the form of:
575
576{ # The request message for synchronous translation.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700577 &quot;labels&quot;: { # Optional. The labels with user-defined metadata for the request.
578 #
579 # Label keys and values can be no longer than 63 characters
580 # (Unicode codepoints), can only contain lowercase letters, numeric
581 # characters, underscores and dashes. International characters are allowed.
582 # Label values are optional. Label keys must start with a letter.
583 #
584 # See https://cloud.google.com/translate/docs/advanced/labels for more
585 # information.
586 &quot;a_key&quot;: &quot;A String&quot;,
587 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700588 &quot;sourceLanguageCode&quot;: &quot;A String&quot;, # Optional. The BCP-47 language code of the input text if
589 # known, for example, &quot;en-US&quot; or &quot;sr-Latn&quot;. Supported language codes are
590 # listed in Language Support. If the source language isn&#x27;t specified, the API
591 # attempts to identify the source language automatically and returns the
592 # source language within the response.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700593 &quot;mimeType&quot;: &quot;A String&quot;, # Optional. The format of the source text, for example, &quot;text/html&quot;,
594 # &quot;text/plain&quot;. If left blank, the MIME type defaults to &quot;text/html&quot;.
Bu Sun Kim65020912020-05-20 12:08:20 -0700595 &quot;model&quot;: &quot;A String&quot;, # Optional. The `model` type requested for this translation.
596 #
597 # The format depends on model type:
598 #
599 # - AutoML Translation models:
600 # `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
601 #
602 # - General (built-in) models:
603 # `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
604 # `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
605 #
606 #
607 # For global (non-regionalized) requests, use `location-id` `global`.
608 # For example,
609 # `projects/{project-number-or-id}/locations/global/models/general/nmt`.
610 #
611 # If missing, the system decides which google base model to use.
612 &quot;contents&quot;: [ # Required. The content of the input in string format.
613 # We recommend the total content be less than 30k codepoints.
614 # Use BatchTranslateText for larger text.
615 &quot;A String&quot;,
616 ],
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700617 &quot;targetLanguageCode&quot;: &quot;A String&quot;, # Required. The BCP-47 language code to use for translation of the input
618 # text, set to one of the language codes listed in Language Support.
Bu Sun Kim65020912020-05-20 12:08:20 -0700619 &quot;glossaryConfig&quot;: { # Configures which glossary should be used for a specific target language, # Optional. Glossary to be applied. The glossary must be
620 # within the same region (have the same location-id) as the model, otherwise
621 # an INVALID_ARGUMENT (400) error is returned.
622 # and defines options for applying that glossary.
623 &quot;glossary&quot;: &quot;A String&quot;, # Required. The `glossary` to be applied for this translation.
624 #
625 # The format depends on glossary:
626 #
627 # - User provided custom glossary:
628 # `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`
629 &quot;ignoreCase&quot;: True or False, # Optional. Indicates match is case-insensitive.
630 # Default value is false if missing.
631 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700632 }
633
634 x__xgafv: string, V1 error format.
635 Allowed values
636 1 - v1 error format
637 2 - v2 error format
638
639Returns:
640 An object of the form:
641
642 {
643 &quot;glossaryTranslations&quot;: [ # Text translation responses if a glossary is provided in the request.
644 # This can be the same as
645 # `translations` if no terms apply.
646 # This field has the same length as
647 # `contents`.
648 { # A single translation response.
Bu Sun Kim65020912020-05-20 12:08:20 -0700649 &quot;glossaryConfig&quot;: { # Configures which glossary should be used for a specific target language, # The `glossary_config` used for this translation.
650 # and defines options for applying that glossary.
651 &quot;glossary&quot;: &quot;A String&quot;, # Required. The `glossary` to be applied for this translation.
652 #
653 # The format depends on glossary:
654 #
655 # - User provided custom glossary:
656 # `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`
657 &quot;ignoreCase&quot;: True or False, # Optional. Indicates match is case-insensitive.
658 # Default value is false if missing.
659 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700660 &quot;detectedLanguageCode&quot;: &quot;A String&quot;, # The BCP-47 language code of source text in the initial request, detected
661 # automatically, if no source language was passed within the initial
662 # request. If the source language was passed, auto-detection of the language
663 # does not occur and this field is empty.
664 &quot;model&quot;: &quot;A String&quot;, # Only present when `model` is present in the request.
665 # `model` here is normalized to have project number.
666 #
667 # For example:
668 # If the `model` requested in TranslationTextRequest is
669 # `projects/{project-id}/locations/{location-id}/models/general/nmt` then
670 # `model` here would be normalized to
671 # `projects/{project-number}/locations/{location-id}/models/general/nmt`.
672 &quot;translatedText&quot;: &quot;A String&quot;, # Text translated into the target language.
Bu Sun Kim65020912020-05-20 12:08:20 -0700673 },
674 ],
675 &quot;translations&quot;: [ # Text translation responses with no glossary applied.
676 # This field has the same length as
677 # `contents`.
678 { # A single translation response.
Bu Sun Kim65020912020-05-20 12:08:20 -0700679 &quot;glossaryConfig&quot;: { # Configures which glossary should be used for a specific target language, # The `glossary_config` used for this translation.
680 # and defines options for applying that glossary.
681 &quot;glossary&quot;: &quot;A String&quot;, # Required. The `glossary` to be applied for this translation.
682 #
683 # The format depends on glossary:
684 #
685 # - User provided custom glossary:
686 # `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`
687 &quot;ignoreCase&quot;: True or False, # Optional. Indicates match is case-insensitive.
688 # Default value is false if missing.
689 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700690 &quot;detectedLanguageCode&quot;: &quot;A String&quot;, # The BCP-47 language code of source text in the initial request, detected
691 # automatically, if no source language was passed within the initial
692 # request. If the source language was passed, auto-detection of the language
693 # does not occur and this field is empty.
694 &quot;model&quot;: &quot;A String&quot;, # Only present when `model` is present in the request.
695 # `model` here is normalized to have project number.
696 #
697 # For example:
698 # If the `model` requested in TranslationTextRequest is
699 # `projects/{project-id}/locations/{location-id}/models/general/nmt` then
700 # `model` here would be normalized to
701 # `projects/{project-number}/locations/{location-id}/models/general/nmt`.
702 &quot;translatedText&quot;: &quot;A String&quot;, # Text translated into the target language.
Bu Sun Kim65020912020-05-20 12:08:20 -0700703 },
704 ],
705 }</pre>
706</div>
707
708</body></html>