-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgoogle-translate-v3.yaml
More file actions
1263 lines (1263 loc) · 72.6 KB
/
google-translate-v3.yaml
File metadata and controls
1263 lines (1263 loc) · 72.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.0
servers:
- url: https://translation.googleapis.com/
info:
contact:
name: Google
url: https://google.com
x-twitter: youtube
description: Integrates text translation into your website or application.
license:
name: Creative Commons Attribution 3.0
url: http://creativecommons.org/licenses/by/3.0/
termsOfService: https://developers.google.com/terms/
title: Cloud Translation API
version: v3
x-apiClientRegistration:
url: https://console.developers.google.com
x-apisguru-categories:
- analytics
- media
x-logo:
url: https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png
x-origin:
- format: openapi
url: https://translation.googleapis.com/$discovery/rest?version=v3
version: "3.0"
x-providerName: googleapis.com
x-serviceName: translate
x-preferred: true
externalDocs:
url: https://cloud.google.com/translate/docs/quickstarts
tags:
- name: projects
paths:
"/v3/{name}":
delete:
description: Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
operationId: translate.projects.locations.operations.delete
parameters:
- description: The name of the operation resource to be deleted.
in: path
name: name
required: true
schema:
type: string
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/Empty"
description: Successful response
security:
- Oauth2:
- https://www.googleapis.com/auth/cloud-platform
Oauth2c:
- https://www.googleapis.com/auth/cloud-platform
- Oauth2:
- https://www.googleapis.com/auth/cloud-translation
Oauth2c:
- https://www.googleapis.com/auth/cloud-translation
tags:
- projects
get:
description: Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
operationId: translate.projects.locations.operations.get
parameters:
- description: The name of the operation resource.
in: path
name: name
required: true
schema:
type: string
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/Operation"
description: Successful response
security:
- Oauth2:
- https://www.googleapis.com/auth/cloud-platform
Oauth2c:
- https://www.googleapis.com/auth/cloud-platform
- Oauth2:
- https://www.googleapis.com/auth/cloud-translation
Oauth2c:
- https://www.googleapis.com/auth/cloud-translation
tags:
- projects
parameters:
- $ref: "#/components/parameters/_.xgafv"
- $ref: "#/components/parameters/access_token"
- $ref: "#/components/parameters/alt"
- $ref: "#/components/parameters/callback"
- $ref: "#/components/parameters/fields"
- $ref: "#/components/parameters/key"
- $ref: "#/components/parameters/oauth_token"
- $ref: "#/components/parameters/prettyPrint"
- $ref: "#/components/parameters/quotaUser"
- $ref: "#/components/parameters/upload_protocol"
- $ref: "#/components/parameters/uploadType"
"/v3/{name}/locations":
get:
description: Lists information about the supported locations for this service.
operationId: translate.projects.locations.list
parameters:
- description: The resource that owns the locations collection, if applicable.
in: path
name: name
required: true
schema:
type: string
- description: A filter to narrow down results to a preferred subset. The filtering language accepts strings like `"displayName=tokyo"`, and is documented in more detail in [AIP-160](https://google.aip.dev/160).
in: query
name: filter
schema:
type: string
- description: The maximum number of results to return. If not set, the service selects a default.
in: query
name: pageSize
schema:
type: integer
- description: A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
in: query
name: pageToken
schema:
type: string
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/ListLocationsResponse"
description: Successful response
security:
- Oauth2:
- https://www.googleapis.com/auth/cloud-platform
Oauth2c:
- https://www.googleapis.com/auth/cloud-platform
- Oauth2:
- https://www.googleapis.com/auth/cloud-translation
Oauth2c:
- https://www.googleapis.com/auth/cloud-translation
tags:
- projects
parameters:
- $ref: "#/components/parameters/_.xgafv"
- $ref: "#/components/parameters/access_token"
- $ref: "#/components/parameters/alt"
- $ref: "#/components/parameters/callback"
- $ref: "#/components/parameters/fields"
- $ref: "#/components/parameters/key"
- $ref: "#/components/parameters/oauth_token"
- $ref: "#/components/parameters/prettyPrint"
- $ref: "#/components/parameters/quotaUser"
- $ref: "#/components/parameters/upload_protocol"
- $ref: "#/components/parameters/uploadType"
"/v3/{name}/operations":
get:
description: "Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding allows API services to override the binding to use different resource name schemes, such as `users/*/operations`. To override the binding, API services can add a binding such as `\"/v1/{name=users/*}/operations\"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id."
operationId: translate.projects.locations.operations.list
parameters:
- description: The name of the operation's parent resource.
in: path
name: name
required: true
schema:
type: string
- description: The standard list filter.
in: query
name: filter
schema:
type: string
- description: The standard list page size.
in: query
name: pageSize
schema:
type: integer
- description: The standard list page token.
in: query
name: pageToken
schema:
type: string
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/ListOperationsResponse"
description: Successful response
security:
- Oauth2:
- https://www.googleapis.com/auth/cloud-platform
Oauth2c:
- https://www.googleapis.com/auth/cloud-platform
- Oauth2:
- https://www.googleapis.com/auth/cloud-translation
Oauth2c:
- https://www.googleapis.com/auth/cloud-translation
tags:
- projects
parameters:
- $ref: "#/components/parameters/_.xgafv"
- $ref: "#/components/parameters/access_token"
- $ref: "#/components/parameters/alt"
- $ref: "#/components/parameters/callback"
- $ref: "#/components/parameters/fields"
- $ref: "#/components/parameters/key"
- $ref: "#/components/parameters/oauth_token"
- $ref: "#/components/parameters/prettyPrint"
- $ref: "#/components/parameters/quotaUser"
- $ref: "#/components/parameters/upload_protocol"
- $ref: "#/components/parameters/uploadType"
"/v3/{name}:cancel":
parameters:
- $ref: "#/components/parameters/_.xgafv"
- $ref: "#/components/parameters/access_token"
- $ref: "#/components/parameters/alt"
- $ref: "#/components/parameters/callback"
- $ref: "#/components/parameters/fields"
- $ref: "#/components/parameters/key"
- $ref: "#/components/parameters/oauth_token"
- $ref: "#/components/parameters/prettyPrint"
- $ref: "#/components/parameters/quotaUser"
- $ref: "#/components/parameters/upload_protocol"
- $ref: "#/components/parameters/uploadType"
post:
description: Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
operationId: translate.projects.locations.operations.cancel
parameters:
- description: The name of the operation resource to be cancelled.
in: path
name: name
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/CancelOperationRequest"
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/Empty"
description: Successful response
security:
- Oauth2:
- https://www.googleapis.com/auth/cloud-platform
Oauth2c:
- https://www.googleapis.com/auth/cloud-platform
- Oauth2:
- https://www.googleapis.com/auth/cloud-translation
Oauth2c:
- https://www.googleapis.com/auth/cloud-translation
tags:
- projects
"/v3/{name}:wait":
parameters:
- $ref: "#/components/parameters/_.xgafv"
- $ref: "#/components/parameters/access_token"
- $ref: "#/components/parameters/alt"
- $ref: "#/components/parameters/callback"
- $ref: "#/components/parameters/fields"
- $ref: "#/components/parameters/key"
- $ref: "#/components/parameters/oauth_token"
- $ref: "#/components/parameters/prettyPrint"
- $ref: "#/components/parameters/quotaUser"
- $ref: "#/components/parameters/upload_protocol"
- $ref: "#/components/parameters/uploadType"
post:
description: Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. If the operation is already done, the latest state is immediately returned. If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC timeout is used. If the server does not support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Note that this method is on a best-effort basis. It may return the latest state before the specified timeout (including immediately), meaning even an immediate response is no guarantee that the operation is done.
operationId: translate.projects.locations.operations.wait
parameters:
- description: The name of the operation resource to wait on.
in: path
name: name
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/WaitOperationRequest"
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/Operation"
description: Successful response
security:
- Oauth2:
- https://www.googleapis.com/auth/cloud-platform
Oauth2c:
- https://www.googleapis.com/auth/cloud-platform
- Oauth2:
- https://www.googleapis.com/auth/cloud-translation
Oauth2c:
- https://www.googleapis.com/auth/cloud-translation
tags:
- projects
"/v3/{parent}/glossaries":
get:
description: Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist.
operationId: translate.projects.locations.glossaries.list
parameters:
- description: Required. The name of the project from which to list all of the glossaries.
in: path
name: parent
required: true
schema:
type: string
- description: "Optional. Filter specifying constraints of a list operation. Specify the constraint by the format of \"key=value\", where key must be \"src\" or \"tgt\", and the value must be a valid language code. For multiple restrictions, concatenate them by \"AND\" (uppercase only), such as: \"src=en-US AND tgt=zh-CN\". Notice that the exact match is used here, which means using 'en-US' and 'en' can lead to different results, which depends on the language code you used when you create the glossary. For the unidirectional glossaries, the \"src\" and \"tgt\" add restrictions on the source and target language code separately. For the equivalent term set glossaries, the \"src\" and/or \"tgt\" add restrictions on the term set. For example: \"src=en-US AND tgt=zh-CN\" will only pick the unidirectional glossaries which exactly match the source language code as \"en-US\" and the target language code \"zh-CN\", but all equivalent term set glossaries which contain \"en-US\" and \"zh-CN\" in their language set will be picked. If missing, no filtering is performed."
in: query
name: filter
schema:
type: string
- description: Optional. Requested page size. The server may return fewer glossaries than requested. If unspecified, the server picks an appropriate default.
in: query
name: pageSize
schema:
type: integer
- description: Optional. A token identifying a page of results the server should return. Typically, this is the value of [ListGlossariesResponse.next_page_token] returned from the previous call to `ListGlossaries` method. The first page is returned if `page_token`is empty or missing.
in: query
name: pageToken
schema:
type: string
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/ListGlossariesResponse"
description: Successful response
security:
- Oauth2:
- https://www.googleapis.com/auth/cloud-platform
Oauth2c:
- https://www.googleapis.com/auth/cloud-platform
- Oauth2:
- https://www.googleapis.com/auth/cloud-translation
Oauth2c:
- https://www.googleapis.com/auth/cloud-translation
tags:
- projects
parameters:
- $ref: "#/components/parameters/_.xgafv"
- $ref: "#/components/parameters/access_token"
- $ref: "#/components/parameters/alt"
- $ref: "#/components/parameters/callback"
- $ref: "#/components/parameters/fields"
- $ref: "#/components/parameters/key"
- $ref: "#/components/parameters/oauth_token"
- $ref: "#/components/parameters/prettyPrint"
- $ref: "#/components/parameters/quotaUser"
- $ref: "#/components/parameters/upload_protocol"
- $ref: "#/components/parameters/uploadType"
post:
description: Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist.
operationId: translate.projects.locations.glossaries.create
parameters:
- description: Required. The project name.
in: path
name: parent
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/Glossary"
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/Operation"
description: Successful response
security:
- Oauth2:
- https://www.googleapis.com/auth/cloud-platform
Oauth2c:
- https://www.googleapis.com/auth/cloud-platform
tags:
- projects
"/v3/{parent}/supportedLanguages":
get:
description: Returns a list of supported languages for translation.
operationId: translate.projects.locations.getSupportedLanguages
parameters:
- description: "Required. Project or location to make a call. Must refer to a caller's project. Format: `projects/{project-number-or-id}` or `projects/{project-number-or-id}/locations/{location-id}`. For global calls, use `projects/{project-number-or-id}/locations/global` or `projects/{project-number-or-id}`. Non-global location is required for AutoML models. Only models within the same region (have same location-id) can be used, otherwise an INVALID_ARGUMENT (400) error is returned."
in: path
name: parent
required: true
schema:
type: string
- description: Optional. The language to use to return localized, human readable names of supported languages. If missing, then display names are not returned in a response.
in: query
name: displayLanguageCode
schema:
type: string
- description: "Optional. Get supported languages of this model. The format depends on model type: - AutoML Translation models: `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - General (built-in) models: `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, Returns languages supported by the specified model. If missing, we get supported languages of Google general NMT model."
in: query
name: model
schema:
type: string
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/SupportedLanguages"
description: Successful response
security:
- Oauth2:
- https://www.googleapis.com/auth/cloud-platform
Oauth2c:
- https://www.googleapis.com/auth/cloud-platform
- Oauth2:
- https://www.googleapis.com/auth/cloud-translation
Oauth2c:
- https://www.googleapis.com/auth/cloud-translation
tags:
- projects
parameters:
- $ref: "#/components/parameters/_.xgafv"
- $ref: "#/components/parameters/access_token"
- $ref: "#/components/parameters/alt"
- $ref: "#/components/parameters/callback"
- $ref: "#/components/parameters/fields"
- $ref: "#/components/parameters/key"
- $ref: "#/components/parameters/oauth_token"
- $ref: "#/components/parameters/prettyPrint"
- $ref: "#/components/parameters/quotaUser"
- $ref: "#/components/parameters/upload_protocol"
- $ref: "#/components/parameters/uploadType"
"/v3/{parent}:batchTranslateDocument":
parameters:
- $ref: "#/components/parameters/_.xgafv"
- $ref: "#/components/parameters/access_token"
- $ref: "#/components/parameters/alt"
- $ref: "#/components/parameters/callback"
- $ref: "#/components/parameters/fields"
- $ref: "#/components/parameters/key"
- $ref: "#/components/parameters/oauth_token"
- $ref: "#/components/parameters/prettyPrint"
- $ref: "#/components/parameters/quotaUser"
- $ref: "#/components/parameters/upload_protocol"
- $ref: "#/components/parameters/uploadType"
post:
description: Translates a large volume of document in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location. This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
operationId: translate.projects.locations.batchTranslateDocument
parameters:
- description: "Required. Location to make a regional call. Format: `projects/{project-number-or-id}/locations/{location-id}`. The `global` location is not supported for batch translation. Only AutoML Translation models or glossaries within the same region (have the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) error is returned."
in: path
name: parent
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/BatchTranslateDocumentRequest"
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/Operation"
description: Successful response
security:
- Oauth2:
- https://www.googleapis.com/auth/cloud-platform
Oauth2c:
- https://www.googleapis.com/auth/cloud-platform
tags:
- projects
"/v3/{parent}:batchTranslateText":
parameters:
- $ref: "#/components/parameters/_.xgafv"
- $ref: "#/components/parameters/access_token"
- $ref: "#/components/parameters/alt"
- $ref: "#/components/parameters/callback"
- $ref: "#/components/parameters/fields"
- $ref: "#/components/parameters/key"
- $ref: "#/components/parameters/oauth_token"
- $ref: "#/components/parameters/prettyPrint"
- $ref: "#/components/parameters/quotaUser"
- $ref: "#/components/parameters/upload_protocol"
- $ref: "#/components/parameters/uploadType"
post:
description: Translates a large volume of text in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location. This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
operationId: translate.projects.locations.batchTranslateText
parameters:
- description: "Required. Location to make a call. Must refer to a caller's project. Format: `projects/{project-number-or-id}/locations/{location-id}`. The `global` location is not supported for batch translation. Only AutoML Translation models or glossaries within the same region (have the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) error is returned."
in: path
name: parent
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/BatchTranslateTextRequest"
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/Operation"
description: Successful response
security:
- Oauth2:
- https://www.googleapis.com/auth/cloud-platform
Oauth2c:
- https://www.googleapis.com/auth/cloud-platform
tags:
- projects
"/v3/{parent}:detectLanguage":
parameters:
- $ref: "#/components/parameters/_.xgafv"
- $ref: "#/components/parameters/access_token"
- $ref: "#/components/parameters/alt"
- $ref: "#/components/parameters/callback"
- $ref: "#/components/parameters/fields"
- $ref: "#/components/parameters/key"
- $ref: "#/components/parameters/oauth_token"
- $ref: "#/components/parameters/prettyPrint"
- $ref: "#/components/parameters/quotaUser"
- $ref: "#/components/parameters/upload_protocol"
- $ref: "#/components/parameters/uploadType"
post:
description: Detects the language of text within a request.
operationId: translate.projects.locations.detectLanguage
parameters:
- description: "Required. Project or location to make a call. Must refer to a caller's project. Format: `projects/{project-number-or-id}/locations/{location-id}` or `projects/{project-number-or-id}`. For global calls, use `projects/{project-number-or-id}/locations/global` or `projects/{project-number-or-id}`. Only models within the same region (has same location-id) can be used. Otherwise an INVALID_ARGUMENT (400) error is returned."
in: path
name: parent
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/DetectLanguageRequest"
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/DetectLanguageResponse"
description: Successful response
security:
- Oauth2:
- https://www.googleapis.com/auth/cloud-platform
Oauth2c:
- https://www.googleapis.com/auth/cloud-platform
- Oauth2:
- https://www.googleapis.com/auth/cloud-translation
Oauth2c:
- https://www.googleapis.com/auth/cloud-translation
tags:
- projects
"/v3/{parent}:translateDocument":
parameters:
- $ref: "#/components/parameters/_.xgafv"
- $ref: "#/components/parameters/access_token"
- $ref: "#/components/parameters/alt"
- $ref: "#/components/parameters/callback"
- $ref: "#/components/parameters/fields"
- $ref: "#/components/parameters/key"
- $ref: "#/components/parameters/oauth_token"
- $ref: "#/components/parameters/prettyPrint"
- $ref: "#/components/parameters/quotaUser"
- $ref: "#/components/parameters/upload_protocol"
- $ref: "#/components/parameters/uploadType"
post:
description: Translates documents in synchronous mode.
operationId: translate.projects.locations.translateDocument
parameters:
- description: "Required. Location to make a regional call. Format: `projects/{project-number-or-id}/locations/{location-id}`. For global calls, use `projects/{project-number-or-id}/locations/global` or `projects/{project-number-or-id}`. Non-global location is required for requests using AutoML models or custom glossaries. Models and glossaries must be within the same region (have the same location-id), otherwise an INVALID_ARGUMENT (400) error is returned."
in: path
name: parent
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/TranslateDocumentRequest"
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/TranslateDocumentResponse"
description: Successful response
security:
- Oauth2:
- https://www.googleapis.com/auth/cloud-platform
Oauth2c:
- https://www.googleapis.com/auth/cloud-platform
- Oauth2:
- https://www.googleapis.com/auth/cloud-translation
Oauth2c:
- https://www.googleapis.com/auth/cloud-translation
tags:
- projects
"/v3/{parent}:translateText":
parameters:
- $ref: "#/components/parameters/_.xgafv"
- $ref: "#/components/parameters/access_token"
- $ref: "#/components/parameters/alt"
- $ref: "#/components/parameters/callback"
- $ref: "#/components/parameters/fields"
- $ref: "#/components/parameters/key"
- $ref: "#/components/parameters/oauth_token"
- $ref: "#/components/parameters/prettyPrint"
- $ref: "#/components/parameters/quotaUser"
- $ref: "#/components/parameters/upload_protocol"
- $ref: "#/components/parameters/uploadType"
post:
description: Translates input text and returns translated text.
operationId: translate.projects.locations.translateText
parameters:
- description: "Required. Project or location to make a call. Must refer to a caller's project. Format: `projects/{project-number-or-id}` or `projects/{project-number-or-id}/locations/{location-id}`. For global calls, use `projects/{project-number-or-id}/locations/global` or `projects/{project-number-or-id}`. Non-global location is required for requests using AutoML models or custom glossaries. Models and glossaries must be within the same region (have same location-id), otherwise an INVALID_ARGUMENT (400) error is returned."
in: path
name: parent
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/TranslateTextRequest"
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/TranslateTextResponse"
description: Successful response
security:
- Oauth2:
- https://www.googleapis.com/auth/cloud-platform
Oauth2c:
- https://www.googleapis.com/auth/cloud-platform
- Oauth2:
- https://www.googleapis.com/auth/cloud-translation
Oauth2c:
- https://www.googleapis.com/auth/cloud-translation
tags:
- projects
components:
parameters:
_.xgafv:
description: V1 error format.
in: query
name: $.xgafv
schema:
enum:
- "1"
- "2"
type: string
access_token:
description: OAuth access token.
in: query
name: access_token
schema:
type: string
alt:
description: Data format for response.
in: query
name: alt
schema:
enum:
- json
- media
- proto
type: string
callback:
description: JSONP
in: query
name: callback
schema:
type: string
fields:
description: Selector specifying which fields to include in a partial response.
in: query
name: fields
schema:
type: string
key:
description: API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
in: query
name: key
schema:
type: string
oauth_token:
description: OAuth 2.0 token for the current user.
in: query
name: oauth_token
schema:
type: string
prettyPrint:
description: Returns response with indentations and line breaks.
in: query
name: prettyPrint
schema:
type: boolean
quotaUser:
description: Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
in: query
name: quotaUser
schema:
type: string
uploadType:
description: Legacy upload protocol for media (e.g. "media", "multipart").
in: query
name: uploadType
schema:
type: string
upload_protocol:
description: Upload protocol for media (e.g. "raw", "multipart").
in: query
name: upload_protocol
schema:
type: string
schemas:
BatchDocumentInputConfig:
description: Input configuration for BatchTranslateDocument request.
properties:
gcsSource:
$ref: "#/components/schemas/GcsSource"
description: "Google Cloud Storage location for the source input. This can be a single file (for example, `gs://translation-test/input.docx`) or a wildcard (for example, `gs://translation-test/*`). File mime type is determined based on extension. Supported mime type includes: - `pdf`, application/pdf - `docx`, application/vnd.openxmlformats-officedocument.wordprocessingml.document - `pptx`, application/vnd.openxmlformats-officedocument.presentationml.presentation - `xlsx`, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB. The max file size to support for `.pdf` is 1GB and the max page limit is 1000 pages. The max file size to support for all input documents is 1GB."
type: object
BatchDocumentOutputConfig:
description: Output configuration for BatchTranslateDocument request.
properties:
gcsDestination:
$ref: "#/components/schemas/GcsDestination"
description: "Google Cloud Storage destination for output content. For every single input document (for example, gs://a/b/c.[extension]), we generate at most 2 * n output files. (n is the # of target_language_codes in the BatchTranslateDocumentRequest). While the input documents are being processed, we write/update an index file `index.csv` under `gcs_destination.output_uri_prefix` (for example, gs://translation_output/index.csv) The index file is generated/updated as new files are being translated. The format is: input_document,target_language_code,translation_output,error_output, glossary_translation_output,glossary_error_output `input_document` is one file we matched using gcs_source.input_uri. `target_language_code` is provided in the request. `translation_output` contains the translations. (details provided below) `error_output` contains the error message during processing of the file. Both translations_file and errors_file could be empty strings if we have no content to output. `glossary_translation_output` and `glossary_error_output` are the translated output/error when we apply glossaries. They could also be empty if we have no content to output. Once a row is present in index.csv, the input/output matching never changes. Callers should also expect all the content in input_file are processed and ready to be consumed (that is, no partial output file is written). 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) The naming format of translation output files follows (for target language code [trg]): `translation_output`: gs://translation_output/a_b_c_[trg]_translation.[extension] `glossary_translation_output`: gs://translation_test/a_b_c_[trg]_glossary_translation.[extension] The output document will maintain the same file format as the input document. The naming format of error output files follows (for target language code [trg]): `error_output`: gs://translation_test/a_b_c_[trg]_errors.txt `glossary_error_output`: gs://translation_test/a_b_c_[trg]_glossary_translation.txt The error output is a txt file containing error details."
type: object
BatchTranslateDocumentRequest:
description: The BatchTranslateDocument request.
properties:
formatConversions:
additionalProperties:
type: string
description: Optional.
type: object
glossaries:
additionalProperties:
$ref: "#/components/schemas/TranslateTextGlossaryConfig"
description: Optional. Glossaries to be applied. It's keyed by target language code.
type: object
inputConfigs:
description: Required. Input configurations. The total number of files matched should be <= 100. The total content size to translate should be <= 100M Unicode codepoints. The files must use UTF-8 encoding.
items:
$ref: "#/components/schemas/BatchDocumentInputConfig"
type: array
models:
additionalProperties:
type: string
description: "Optional. The models to use for translation. Map's key is target language code. Map's value is the model name. Value can be a built-in general model, or an AutoML Translation model. The value format depends on model type: - AutoML Translation models: `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - General (built-in) models: `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, If the map is empty or a specific model is not requested for a language pair, then default google model (nmt) is used."
type: object
outputConfig:
$ref: "#/components/schemas/BatchDocumentOutputConfig"
description: Required. Output configuration. If 2 input configs match to the same file (that is, same input path), we don't generate output for duplicate inputs.
sourceLanguageCode:
description: Required. The BCP-47 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).
type: string
targetLanguageCodes:
description: Required. The BCP-47 language code to use for translation of the input document. Specify up to 10 language codes here.
items:
type: string
type: array
type: object
BatchTranslateTextRequest:
description: The batch translation request.
properties:
glossaries:
additionalProperties:
$ref: "#/components/schemas/TranslateTextGlossaryConfig"
description: Optional. Glossaries to be applied for translation. It's keyed by target language code.
type: object
inputConfigs:
description: Required. Input configurations. The total number of files matched should be <= 100. The total content size should be <= 100M Unicode codepoints. The files must use UTF-8 encoding.
items:
$ref: "#/components/schemas/InputConfig"
type: array
labels:
additionalProperties:
type: string
description: Optional. The labels with user-defined metadata for the request. Label keys and values can be no longer than 63 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter. See https://cloud.google.com/translate/docs/advanced/labels for more information.
type: object
models:
additionalProperties:
type: string
description: "Optional. The models to use for translation. Map's key is target language code. Map's value is model name. Value can be a built-in general model, or an AutoML Translation model. The value format depends on model type: - AutoML Translation models: `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - General (built-in) models: `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, If the map is empty or a specific model is not requested for a language pair, then default google model (nmt) is used."
type: object
outputConfig:
$ref: "#/components/schemas/OutputConfig"
description: Required. Output configuration. If 2 input configs match to the same file (that is, same input path), we don't generate output for duplicate inputs.
sourceLanguageCode:
description: Required. Source language code.
type: string
targetLanguageCodes:
description: Required. Specify up to 10 language codes here.
items:
type: string
type: array
type: object
CancelOperationRequest:
description: The request message for Operations.CancelOperation.
properties: {}
type: object
DetectLanguageRequest:
description: The request message for language detection.
properties:
content:
description: The content of the input stored as a string.
type: string
labels:
additionalProperties:
type: string
description: Optional. The labels with user-defined metadata for the request. Label keys and values can be no longer than 63 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter. See https://cloud.google.com/translate/docs/advanced/labels for more information.
type: object
mimeType:
description: Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html".
type: string
model:
description: "Optional. The language detection model to be used. Format: `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` Only one language detection model is currently supported: `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. If not specified, the default model is used."
type: string
type: object
DetectLanguageResponse:
description: The response message for language detection.
properties:
languages:
description: The most probable language detected by the Translation API. For each request, the Translation API will always return only one result.
items:
$ref: "#/components/schemas/DetectedLanguage"
type: array
type: object
DetectedLanguage:
description: The response message for language detection.
properties:
confidence:
description: The confidence of the detection result for this language.
format: float
type: number
languageCode:
description: The BCP-47 language code of source content in the request, detected automatically.
type: string
type: object
DocumentInputConfig:
description: A document translation request input config.
properties:
content:
description: Document's content represented as a stream of bytes.
format: byte
type: string
gcsSource:
$ref: "#/components/schemas/GcsSource"
description: "Google Cloud Storage location. This must be a single file. For example: gs://example_bucket/example_file.pdf"
mimeType:
description: "Specifies the input document's mime_type. If not specified it will be determined using the file extension for gcs_source provided files. For a file provided through bytes content the mime_type must be provided. Currently supported mime types are: - application/pdf - application/vnd.openxmlformats-officedocument.wordprocessingml.document - application/vnd.openxmlformats-officedocument.presentationml.presentation - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
type: string
type: object
DocumentOutputConfig:
description: A document translation request output config.
properties:
gcsDestination:
$ref: "#/components/schemas/GcsDestination"
description: "Optional. Google Cloud Storage destination for the translation output, e.g., `gs://my_bucket/my_directory/`. The destination directory provided does not have to be empty, but the bucket must exist. If a file with the same name as the output file already exists in the destination an error will be returned. For a DocumentInputConfig.contents provided document, the output file will have the name \"output_[trg]_translations.[ext]\", where - [trg] corresponds to the translated file's language code, - [ext] corresponds to the translated file's extension according to its mime type. For a DocumentInputConfig.gcs_uri provided document, the output file will have a name according to its URI. For example: an input file with URI: \"gs://a/b/c.[extension]\" stored in a gcs_destination bucket with name \"my_bucket\" will have an output URI: \"gs://my_bucket/a_b_c_[trg]_translations.[ext]\", where - [trg] corresponds to the translated file's language code, - [ext] corresponds to the translated file's extension according to its mime type. If the document was directly provided through the request, then the output document will have the format: \"gs://my_bucket/translated_document_[trg]_translations.[ext], where - [trg] corresponds to the translated file's language code, - [ext] corresponds to the translated file's extension according to its mime type. If a glossary was provided, then the output URI for the glossary translation will be equal to the default output URI but have `glossary_translations` instead of `translations`. For the previous example, its glossary URI would be: \"gs://my_bucket/a_b_c_[trg]_glossary_translations.[ext]\". Thus the max number of output files will be 2 (Translated document, Glossary translated document). Callers should expect no partial outputs. If there is any error during document translation, no output will be stored in the Cloud Storage bucket."
mimeType:
description: Optional. Specifies the translated document's mime_type. If not specified, the translated file's mime type will be the same as the input file's mime type. Currently only support the output mime type to be the same as input mime type. - application/pdf - application/vnd.openxmlformats-officedocument.wordprocessingml.document - application/vnd.openxmlformats-officedocument.presentationml.presentation - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
type: string
type: object
DocumentTranslation:
description: A translated document message.
properties:
byteStreamOutputs:
description: The array of translated documents. It is expected to be size 1 for now. We may produce multiple translated documents in the future for other type of file formats.
items:
format: byte
type: string
type: array
detectedLanguageCode:
description: The detected language for the input document. If the user did not provide the source language for the input document, this field will have the language code automatically detected. If the source language was passed, auto-detection of the language does not occur and this field is empty.
type: string
mimeType:
description: The translated document's mime type.
type: string
type: object
Empty:
description: "A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }"
properties: {}
type: object
GcsDestination:
description: The Google Cloud Storage location for the output content.
properties:
outputUriPrefix:
description: Required. The bucket used in 'output_uri_prefix' must exist and there must be no files under 'output_uri_prefix'. 'output_uri_prefix' must end with "/" and start with "gs://". One 'output_uri_prefix' can only be used by one batch translation job at a time. Otherwise an INVALID_ARGUMENT (400) error is returned.
type: string
type: object
GcsSource:
description: The Google Cloud Storage location for the input content.
properties:
inputUri:
description: Required. Source data URI. For example, `gs://my_bucket/my_object`.
type: string
type: object
Glossary:
description: Represents a glossary built from user provided data.
properties:
endTime:
description: Output only. When the glossary creation was finished.
format: google-datetime
readOnly: true
type: string
entryCount:
description: Output only. The number of entries defined in the glossary.
format: int32
readOnly: true
type: integer
inputConfig:
$ref: "#/components/schemas/GlossaryInputConfig"
description: Required. Provides examples to build the glossary from. Total glossary must not exceed 10M Unicode codepoints.
languageCodesSet:
$ref: "#/components/schemas/LanguageCodesSet"
description: Used with equivalent term set glossaries.
languagePair:
$ref: "#/components/schemas/LanguageCodePair"
description: Used with unidirectional glossaries.
name:
description: Required. The resource name of the glossary. Glossary names have the form `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`.
type: string
submitTime:
description: Output only. When CreateGlossary was called.
format: google-datetime
readOnly: true
type: string
type: object
GlossaryInputConfig:
description: Input configuration for glossaries.
properties:
gcsSource:
$ref: "#/components/schemas/GcsSource"
description: "Required. Google Cloud Storage location of glossary data. File format is determined based on the filename extension. API returns [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file formats. Wildcards are not allowed. This must be a single file in one of the following formats: For unidirectional glossaries: - TSV/CSV (`.tsv`/`.csv`): 2 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. - TMX (`.tmx`): TMX file with parallel data defining source/target term pairs. For equivalent term sets glossaries: - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms in multiple languages. See documentation for more information - [glossaries](https://cloud.google.com/translate/docs/advanced/glossary)."
type: object
InputConfig:
description: Input configuration for BatchTranslateText request.
properties:
gcsSource:
$ref: "#/components/schemas/GcsSource"
description: Required. Google Cloud Storage location for the source input. This can be a single file (for example, `gs://translation-test/input.tsv`) or a wildcard (for example, `gs://translation-test/*`). If a file extension is `.tsv`, it can contain either one or two columns. The first column (optional) is the id of the text request. If the first column is missing, we use the row number (0-based) from the input file as the ID in the output file. The second column is the actual text to be translated. We recommend each row be <= 10K Unicode codepoints, otherwise an error might be returned. Note that the input tsv must be RFC 4180 compliant. You could use https://github.com/Clever/csvlint to check potential formatting errors in your tsv file. csvlint --delimiter='\t' your_input_file.tsv The other supported file extensions are `.txt` or `.html`, which is treated as a single large chunk of text.
mimeType:
description: Optional. Can be "text/plain" or "text/html". For `.tsv`, "text/html" is used if mime_type is missing. For `.html`, this field must be "text/html" or empty. For `.txt`, this field must be "text/plain" or empty.
type: string
type: object
LanguageCodePair:
description: Used with unidirectional glossaries.
properties:
sourceLanguageCode:
description: Required. The BCP-47 language code of the input text, for example, "en-US". Expected to be an exact match for GlossaryTerm.language_code.
type: string
targetLanguageCode:
description: Required. The BCP-47 language code for translation output, for example, "zh-CN". Expected to be an exact match for GlossaryTerm.language_code.
type: string
type: object
LanguageCodesSet:
description: Used with equivalent term set glossaries.
properties:
languageCodes:
description: The BCP-47 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.
items:
type: string
type: array
type: object
ListGlossariesResponse:
description: Response message for ListGlossaries.
properties:
glossaries:
description: The list of glossaries for a project.
items:
$ref: "#/components/schemas/Glossary"
type: array