You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cognitive-services/Translator/reference/v3-0-translate.md
+10-8Lines changed: 10 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ manager: nitinme
9
9
ms.service: cognitive-services
10
10
ms.subservice: translator-text
11
11
ms.topic: reference
12
-
ms.date: 08/15/2022
12
+
ms.date: 09/07/2022
13
13
ms.author: lajanuar
14
14
---
15
15
@@ -120,8 +120,9 @@ Examples of JSON responses are provided in the [examples](#examples) section.
120
120
121
121
| Headers | Description |
122
122
| --- | --- |
123
-
| X-RequestId | Value generated by the service to identify the request. It's used for troubleshooting purposes. |
124
-
| X-MT-System | Specifies the system type that was used for translation for each 'to' language requested for translation. The value is a comma-separated list of strings. Each string indicates a type: <br><br>* Custom - Request includes a custom system and at least one custom system was used during translation.<br>* Team - All other requests |
123
+
| X-requestid | Value generated by the service to identify the request. It's used for troubleshooting purposes. |
124
+
| X-mt-system | Specifies the system type that was used for translation for each 'to' language requested for translation. The value is a comma-separated list of strings. Each string indicates a type: <br><br>* Custom - Request includes a custom system and at least one custom system was used during translation.<br>* Team - All other requests |
125
+
| X-metered-usage |Specifies consumption (the number of characters for which the user will be charged) for the translation job request. For example, if the word "Hello" is translated from English (en) to French (fr), this field will return the value '5'.|
125
126
126
127
## Response status codes
127
128
@@ -371,14 +372,15 @@ The response is:
371
372
The alignment information starts with `0:2-0:1`, which means that the first three characters in the source text (`The`) map to the first two characters in the translated text (`La`).
372
373
373
374
#### Limitations
375
+
374
376
Obtaining alignment information is an experimental feature that we've enabled for prototyping research and experiences with potential phrase mappings. We may choose to stop supporting this feature in the future. Here are some of the notable restrictions where alignments aren't supported:
375
377
376
378
* Alignment isn't available for text in HTML format that is, textType=html
377
379
* Alignment is only returned for a subset of the language pairs:
378
-
- English to/from any other language except Chinese Traditional, Cantonese (Traditional) or Serbian (Cyrillic).
379
-
- from Japanese to Korean or from Korean to Japanese.
380
-
- from Japanese to Chinese Simplified and Chinese Simplified to Japanese.
381
-
- from Chinese Simplified to Chinese Traditional and Chinese Traditional to Chinese Simplified.
380
+
* English to/from any other language except Chinese Traditional, Cantonese (Traditional) or Serbian (Cyrillic).
381
+
* from Japanese to Korean or from Korean to Japanese.
382
+
* from Japanese to Chinese Simplified and Chinese Simplified to Japanese.
383
+
* from Chinese Simplified to Chinese Traditional and Chinese Traditional to Chinese Simplified.
382
384
* You won't receive alignment if the sentence is a canned translation. Example of a canned translation is "This is a test", "I love you" and other high frequency sentences.
383
385
* Alignment isn't available when you apply any of the approaches to prevent translation as described [here](../prevent-translation.md)
384
386
@@ -392,7 +394,7 @@ curl -X POST "https://api.cognitive.microsofttranslator.com/translate?api-versio
@@ -60,7 +60,7 @@ To call the Translator service via the [REST API](reference/rest-api-guide.md),
60
60
|**X-ClientTraceId**|A client-generated GUID to uniquely identify the request. You can omit this header if you include the trace ID in the query string using a query parameter named ClientTraceId.|<ul><li>***Optional***</li></ul>
61
61
|||
62
62
63
-
## Setup your application
63
+
## Set up your application
64
64
65
65
### [C#](#tab/csharp)
66
66
@@ -113,7 +113,7 @@ To call the Translator service via the [REST API](reference/rest-api-guide.md),
113
113
114
114
1. Open the **Program.cs** file.
115
115
116
-
1. Delete the pre-existing code, including the line `Console.Writeline("Hello World!")`. You will copy and paste the code samples into your application's Program.cs file. For each code sample, make sure you update the key and endpoint variables with values from your Azure portal Translator instance.
116
+
1. Delete the pre-existing code, including the line `Console.Writeline("Hello World!")`. You'll copy and paste the code samples into your application's Program.cs file. For each code sample, make sure you update the key and endpoint variables with values from your Azure portal Translator instance.
117
117
118
118
1. Once you've added a desired code sample to your application, choose the green **start button** next to formRecognizer_quickstart to build and run your program, or press **F5**.
119
119
@@ -141,7 +141,7 @@ You can use any text editor to write Go applications. We recommend using the lat
141
141
142
142
1. Create a new GO file named **text-translator.go** from the **translator-text-app** directory.
143
143
144
-
1. You will copy and paste the code samples into your **text-translator.go** file. Make sure you update the key variable with the value from your Azure portal Translator instance.
144
+
1. You'll copy and paste the code samples into your **text-translator.go** file. Make sure you update the key variable with the value from your Azure portal Translator instance.
145
145
146
146
1. Once you've added a code sample to your application, your Go program can be executed in a command or terminal prompt. Make sure your prompt's path is set to the **translator-text-app** folder and use the following command:
147
147
@@ -227,7 +227,7 @@ You can use any text editor to write Go applications. We recommend using the lat
227
227
>
228
228
> * You can also create a new file in your IDE named `TranslatorText.java` and save it to the `java` directory.
229
229
230
-
1. You will copy and paste the code samples `TranslatorText.java` file. **Make sure you update the key with one of the key values from your Azure portal Translator instance**.
230
+
1. You'll copy and paste the code samples `TranslatorText.java` file. **Make sure you update the key with one of the key values from your Azure portal Translator instance**.
231
231
232
232
1. Once you've added a code sample to your application, navigate back to your main project directory—**translator-text-app**, open a console window, and enter the following commands:
233
233
@@ -290,7 +290,7 @@ You can use any text editor to write Go applications. We recommend using the lat
290
290
>
291
291
> * You can also create a new file named `index.js` in your IDE and save it to the `translator-text-app` directory.
292
292
293
-
1. You will copy and paste the code samples into your `index.js` file. **Make sure you update the key variable with the value from your Azure portal Translator instance**.
293
+
1. You'll copy and paste the code samples into your `index.js` file. **Make sure you update the key variable with the value from your Azure portal Translator instance**.
294
294
295
295
1. Once you've added the code sample to your application, run your program:
296
296
@@ -611,6 +611,8 @@ After a successful call, you should see the following response:
611
611
]
612
612
```
613
613
614
+
You can check the consumption (the number of characters for which you'll be charged) for each request in the [**response headers: x-metered-usage**](reference/v3-0-translate.md#response-headers) field.
615
+
614
616
## Detect language
615
617
616
618
If you need translation, but don't know the language of the text, you can use the language detection operation. There's more than one way to identify the source text language. In this section, you'll learn how to use language detection using the `translate` endpoint, and the `detect` endpoint.
0 commit comments