Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 1 | <html><body> |
| 2 | <style> |
| 3 | |
| 4 | body, 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 | |
| 15 | body { |
| 16 | font-size: 13px; |
| 17 | padding: 1em; |
| 18 | } |
| 19 | |
| 20 | h1 { |
| 21 | font-size: 26px; |
| 22 | margin-bottom: 1em; |
| 23 | } |
| 24 | |
| 25 | h2 { |
| 26 | font-size: 24px; |
| 27 | margin-bottom: 1em; |
| 28 | } |
| 29 | |
| 30 | h3 { |
| 31 | font-size: 20px; |
| 32 | margin-bottom: 1em; |
| 33 | margin-top: 1em; |
| 34 | } |
| 35 | |
| 36 | pre, code { |
| 37 | line-height: 1.5; |
| 38 | font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; |
| 39 | } |
| 40 | |
| 41 | pre { |
| 42 | margin-top: 0.5em; |
| 43 | } |
| 44 | |
| 45 | h1, h2, h3, p { |
| 46 | font-family: Arial, sans serif; |
| 47 | } |
| 48 | |
| 49 | h1, 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 Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 97 | <code><a href="#getSupportedLanguages">getSupportedLanguages(parent, displayLanguageCode=None, model=None, x__xgafv=None)</a></code></p> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 98 | <p class="firstline">Returns a list of supported languages for translation.</p> |
| 99 | <p class="toc_element"> |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 100 | <code><a href="#list">list(name, pageSize=None, filter=None, pageToken=None, x__xgafv=None)</a></code></p> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 101 | <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. |
| 112 | This function provides real-time output as the inputs are being processed. |
| 113 | If caller cancels a request, the partial results (for an input file, it's |
| 114 | all or nothing) may still be available on the specified output location. |
| 115 | |
| 116 | This call returns immediately and you can |
| 117 | use google.longrunning.Operation.name to poll the status of the call. |
| 118 | |
| 119 | Args: |
| 120 | parent: string, Required. Location to make a call. Must refer to a caller's project. |
| 121 | |
| 122 | Format: `projects/{project-number-or-id}/locations/{location-id}`. |
| 123 | |
| 124 | The `global` location is not supported for batch translation. |
| 125 | |
| 126 | Only AutoML Translation models or glossaries within the same region (have |
| 127 | the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) |
| 128 | error is returned. (required) |
| 129 | body: object, The request body. |
| 130 | The object takes the form of: |
| 131 | |
| 132 | { # The batch translation request. |
| 133 | "sourceLanguageCode": "A String", # Required. Source language code. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 134 | "labels": { # 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 | "a_key": "A String", |
| 144 | }, |
| 145 | "models": { # Optional. The models to use for translation. Map's key is target language |
| 146 | # code. Map'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 | "a_key": "A String", |
| 162 | }, |
| 163 | "glossaries": { # Optional. Glossaries to be applied for translation. |
| 164 | # It's keyed by target language code. |
| 165 | "a_key": { # Configures which glossary should be used for a specific target language, |
| 166 | # and defines options for applying that glossary. |
| 167 | "glossary": "A String", # 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 | "ignoreCase": True or False, # Optional. Indicates match is case-insensitive. |
| 174 | # Default value is false if missing. |
| 175 | }, |
| 176 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 177 | "outputConfig": { # 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't generate output for duplicate inputs. |
| 180 | "gcsDestination": { # 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 '\n' instead of '\r\n'. We don'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 | # 'index.csv' under 'output_uri_prefix' (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 'trg') is: |
| 213 | # gs://translation_test/a_b_c_'trg'_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'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_'trg'_glossary_translations.[extension] |
| 231 | # |
| 232 | # The format of errors file (for target language code 'trg') is: |
| 233 | # gs://translation_test/a_b_c_'trg'_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'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_'trg'_glossary_errors.[extension] |
| 246 | "outputUriPrefix": "A String", # Required. The bucket used in 'output_uri_prefix' must exist and there must be no |
| 247 | # files under 'output_uri_prefix'. 'output_uri_prefix' must end with "/" and |
| 248 | # start with "gs://". One 'output_uri_prefix' 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 Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 253 | "targetLanguageCodes": [ # Required. Specify up to 10 language codes here. |
| 254 | "A String", |
| 255 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 256 | "inputConfigs": [ # Required. Input configurations. |
| 257 | # The total number of files matched should be <= 1000. |
| 258 | # The total content size should be <= 100M Unicode codepoints. |
| 259 | # The files must use UTF-8 encoding. |
| 260 | { # Input configuration for BatchTranslateText request. |
| 261 | "gcsSource": { # 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 <= 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='\t' 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 | "inputUri": "A String", # Required. Source data URI. For example, `gs://my_bucket/my_object`. |
| 280 | }, |
| 281 | "mimeType": "A String", # Optional. Can be "text/plain" or "text/html". |
| 282 | # For `.tsv`, "text/html" is used if mime_type is missing. |
| 283 | # For `.html`, this field must be "text/html" or empty. |
| 284 | # For `.txt`, this field must be "text/plain" or empty. |
| 285 | }, |
| 286 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 287 | } |
| 288 | |
| 289 | x__xgafv: string, V1 error format. |
| 290 | Allowed values |
| 291 | 1 - v1 error format |
| 292 | 2 - v2 error format |
| 293 | |
| 294 | Returns: |
| 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 Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 299 | "name": "A String", # 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 | "error": { # 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 | "code": 42, # The status code, which should be an enum value of google.rpc.Code. |
| 310 | "message": "A String", # 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 | "details": [ # A list of messages that carry the error details. There is a common set of |
| 314 | # message types for APIs to use. |
| 315 | { |
| 316 | "a_key": "", # Properties of the object. Contains field @type with type URL. |
| 317 | }, |
| 318 | ], |
| 319 | }, |
| 320 | "metadata": { # 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 | "a_key": "", # Properties of the object. Contains field @type with type URL. |
| 325 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 326 | "done": 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 Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 329 | "response": { # 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 | "a_key": "", # Properties of the object. Contains field @type with type URL. |
| 338 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 339 | }</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 | |
| 346 | Args: |
| 347 | parent: string, Required. Project or location to make a call. Must refer to a caller's |
| 348 | project. |
| 349 | |
| 350 | Format: `projects/{project-number-or-id}/locations/{location-id}` or |
| 351 | `projects/{project-number-or-id}`. |
| 352 | |
| 353 | For global calls, use `projects/{project-number-or-id}/locations/global` or |
| 354 | `projects/{project-number-or-id}`. |
| 355 | |
| 356 | Only models within the same region (has same location-id) can be used. |
| 357 | Otherwise 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 Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 362 | "labels": { # 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 | "a_key": "A String", |
| 372 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 373 | "content": "A String", # The content of the input stored as a string. |
| 374 | "mimeType": "A String", # Optional. The format of the source text, for example, "text/html", |
| 375 | # "text/plain". If left blank, the MIME type defaults to "text/html". |
| 376 | "model": "A String", # 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 Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 385 | } |
| 386 | |
| 387 | x__xgafv: string, V1 error format. |
| 388 | Allowed values |
| 389 | 1 - v1 error format |
| 390 | 2 - v2 error format |
| 391 | |
| 392 | Returns: |
| 393 | An object of the form: |
| 394 | |
| 395 | { # The response message for language detection. |
| 396 | "languages": [ # 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 | "confidence": 3.14, # The confidence of the detection result for this language. |
| 400 | "languageCode": "A String", # 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 | |
| 411 | Args: |
| 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 | |
| 418 | Returns: |
| 419 | An object of the form: |
| 420 | |
| 421 | { # A resource that represents Google Cloud Platform location. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 422 | "displayName": "A String", # The friendly name for this location, typically a nearby city name. |
| 423 | # For example, "Tokyo". |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 424 | "labels": { # Cross-service attributes for the location. For example |
| 425 | # |
| 426 | # {"cloud.googleapis.com/region": "us-east1"} |
| 427 | "a_key": "A String", |
| 428 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 429 | "locationId": "A String", # The canonical id for this location. For example: `"us-east1"`. |
| 430 | "metadata": { # Service-specific metadata. For example the available capacity at the given |
| 431 | # location. |
| 432 | "a_key": "", # Properties of the object. Contains field @type with type URL. |
| 433 | }, |
| 434 | "name": "A String", # Resource name for the location, which may vary between implementations. |
| 435 | # For example: `"projects/example-project/locations/us-east1"` |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 436 | }</pre> |
| 437 | </div> |
| 438 | |
| 439 | <div class="method"> |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 440 | <code class="details" id="getSupportedLanguages">getSupportedLanguages(parent, displayLanguageCode=None, model=None, x__xgafv=None)</code> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 441 | <pre>Returns a list of supported languages for translation. |
| 442 | |
| 443 | Args: |
| 444 | parent: string, Required. Project or location to make a call. Must refer to a caller's |
| 445 | project. |
| 446 | |
| 447 | Format: `projects/{project-number-or-id}` or |
| 448 | `projects/{project-number-or-id}/locations/{location-id}`. |
| 449 | |
| 450 | For global calls, use `projects/{project-number-or-id}/locations/global` or |
| 451 | `projects/{project-number-or-id}`. |
| 452 | |
| 453 | Non-global location is required for AutoML models. |
| 454 | |
| 455 | Only models within the same region (have same location-id) can be used, |
| 456 | otherwise an INVALID_ARGUMENT (400) error is returned. (required) |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 457 | displayLanguageCode: string, Optional. The language to use to return localized, human readable names |
| 458 | of supported languages. If missing, then display names are not returned |
| 459 | in a response. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 460 | model: string, Optional. Get supported languages of this model. |
| 461 | |
| 462 | The 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 | |
| 472 | Returns languages supported by the specified model. |
| 473 | If 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 | |
| 479 | Returns: |
| 480 | An object of the form: |
| 481 | |
| 482 | { # The response message for discovering supported languages. |
| 483 | "languages": [ # 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 Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 487 | "displayName": "A String", # Human readable name of the language localized in the display language |
| 488 | # specified in the request. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 489 | "languageCode": "A String", # Supported language code, generally consisting of its ISO 639-1 |
| 490 | # identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes |
| 491 | # including language and region identifiers are returned (for example, |
| 492 | # 'zh-TW' and 'zh-CN') |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 493 | "supportSource": True or False, # Can be used as source language. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 494 | "supportTarget": True or False, # Can be used as target language. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 495 | }, |
| 496 | ], |
| 497 | }</pre> |
| 498 | </div> |
| 499 | |
| 500 | <div class="method"> |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 501 | <code class="details" id="list">list(name, pageSize=None, filter=None, pageToken=None, x__xgafv=None)</code> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 502 | <pre>Lists information about the supported locations for this service. |
| 503 | |
| 504 | Args: |
| 505 | name: string, The resource that owns the locations collection, if applicable. (required) |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 506 | pageSize: integer, The standard list page size. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 507 | filter: string, The standard list filter. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 508 | pageToken: string, The standard list page token. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 509 | x__xgafv: string, V1 error format. |
| 510 | Allowed values |
| 511 | 1 - v1 error format |
| 512 | 2 - v2 error format |
| 513 | |
| 514 | Returns: |
| 515 | An object of the form: |
| 516 | |
| 517 | { # The response message for Locations.ListLocations. |
| 518 | "nextPageToken": "A String", # The standard List next-page token. |
| 519 | "locations": [ # A list of locations that matches the specified filter in the request. |
| 520 | { # A resource that represents Google Cloud Platform location. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 521 | "displayName": "A String", # The friendly name for this location, typically a nearby city name. |
| 522 | # For example, "Tokyo". |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 523 | "labels": { # Cross-service attributes for the location. For example |
| 524 | # |
| 525 | # {"cloud.googleapis.com/region": "us-east1"} |
| 526 | "a_key": "A String", |
| 527 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 528 | "locationId": "A String", # The canonical id for this location. For example: `"us-east1"`. |
| 529 | "metadata": { # Service-specific metadata. For example the available capacity at the given |
| 530 | # location. |
| 531 | "a_key": "", # Properties of the object. Contains field @type with type URL. |
| 532 | }, |
| 533 | "name": "A String", # Resource name for the location, which may vary between implementations. |
| 534 | # For example: `"projects/example-project/locations/us-east1"` |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 535 | }, |
| 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 | |
| 544 | Args: |
| 545 | previous_request: The request for the previous page. (required) |
| 546 | previous_response: The response from the request for the previous page. (required) |
| 547 | |
| 548 | Returns: |
| 549 | A request object that you can call 'execute()' 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 | |
| 558 | Args: |
| 559 | parent: string, Required. Project or location to make a call. Must refer to a caller's |
| 560 | project. |
| 561 | |
| 562 | Format: `projects/{project-number-or-id}` or |
| 563 | `projects/{project-number-or-id}/locations/{location-id}`. |
| 564 | |
| 565 | For global calls, use `projects/{project-number-or-id}/locations/global` or |
| 566 | `projects/{project-number-or-id}`. |
| 567 | |
| 568 | Non-global location is required for requests using AutoML models or |
| 569 | custom glossaries. |
| 570 | |
| 571 | Models and glossaries must be within the same region (have same |
| 572 | location-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 Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 577 | "labels": { # 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 | "a_key": "A String", |
| 587 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 588 | "sourceLanguageCode": "A String", # Optional. The BCP-47 language code of the input text if |
| 589 | # known, for example, "en-US" or "sr-Latn". Supported language codes are |
| 590 | # listed in Language Support. If the source language isn't specified, the API |
| 591 | # attempts to identify the source language automatically and returns the |
| 592 | # source language within the response. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 593 | "mimeType": "A String", # Optional. The format of the source text, for example, "text/html", |
| 594 | # "text/plain". If left blank, the MIME type defaults to "text/html". |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 595 | "model": "A String", # 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 | "contents": [ # 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 | "A String", |
| 616 | ], |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 617 | "targetLanguageCode": "A String", # 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 Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 619 | "glossaryConfig": { # 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 | "glossary": "A String", # 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 | "ignoreCase": True or False, # Optional. Indicates match is case-insensitive. |
| 630 | # Default value is false if missing. |
| 631 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 632 | } |
| 633 | |
| 634 | x__xgafv: string, V1 error format. |
| 635 | Allowed values |
| 636 | 1 - v1 error format |
| 637 | 2 - v2 error format |
| 638 | |
| 639 | Returns: |
| 640 | An object of the form: |
| 641 | |
| 642 | { |
| 643 | "glossaryTranslations": [ # 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 Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 649 | "glossaryConfig": { # 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 | "glossary": "A String", # 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 | "ignoreCase": True or False, # Optional. Indicates match is case-insensitive. |
| 658 | # Default value is false if missing. |
| 659 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 660 | "detectedLanguageCode": "A String", # 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 | "model": "A String", # 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 | "translatedText": "A String", # Text translated into the target language. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 673 | }, |
| 674 | ], |
| 675 | "translations": [ # Text translation responses with no glossary applied. |
| 676 | # This field has the same length as |
| 677 | # `contents`. |
| 678 | { # A single translation response. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 679 | "glossaryConfig": { # 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 | "glossary": "A String", # 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 | "ignoreCase": True or False, # Optional. Indicates match is case-insensitive. |
| 688 | # Default value is false if missing. |
| 689 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 690 | "detectedLanguageCode": "A String", # 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 | "model": "A String", # 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 | "translatedText": "A String", # Text translated into the target language. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 703 | }, |
| 704 | ], |
| 705 | }</pre> |
| 706 | </div> |
| 707 | |
| 708 | </body></html> |