Skip to content

Commit 07bb8e1

Browse files
Merge pull request #210462 from laujan/1982056-update-text-translation-char-count-charge
update char count charge and date
2 parents e11b11d + 859f041 commit 07bb8e1

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

articles/cognitive-services/Translator/reference/v3-0-translate.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ manager: nitinme
99
ms.service: cognitive-services
1010
ms.subservice: translator-text
1111
ms.topic: reference
12-
ms.date: 08/15/2022
12+
ms.date: 09/07/2022
1313
ms.author: lajanuar
1414
---
1515

@@ -120,8 +120,9 @@ Examples of JSON responses are provided in the [examples](#examples) section.
120120

121121
| Headers | Description |
122122
| --- | --- |
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'.|
125126

126127
## Response status codes
127128

@@ -371,14 +372,15 @@ The response is:
371372
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`).
372373

373374
#### Limitations
375+
374376
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:
375377

376378
* Alignment isn't available for text in HTML format that is, textType=html
377379
* 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.
382384
* 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.
383385
* Alignment isn't available when you apply any of the approaches to prevent translation as described [here](../prevent-translation.md)
384386

@@ -392,7 +394,7 @@ curl -X POST "https://api.cognitive.microsofttranslator.com/translate?api-versio
392394

393395
The response is:
394396

395-
```
397+
```json
396398
[
397399
{
398400
"translations":[

articles/cognitive-services/Translator/translator-text-apis.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ manager: nitinme
88
ms.service: cognitive-services
99
ms.subservice: translator-text
1010
ms.topic: how-to
11-
ms.date: 06/20/2022
11+
ms.date: 09/07/2022
1212
ms.author: lajanuar
1313
ms.devlang: csharp, golang, java, javascript, python
1414
ms.custom: cog-serv-seo-aug-2020, mode-other
@@ -60,7 +60,7 @@ To call the Translator service via the [REST API](reference/rest-api-guide.md),
6060
|**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>
6161
|||
6262

63-
## Setup your application
63+
## Set up your application
6464

6565
### [C#](#tab/csharp)
6666

@@ -113,7 +113,7 @@ To call the Translator service via the [REST API](reference/rest-api-guide.md),
113113
114114
1. Open the **Program.cs** file.
115115

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.
117117

118118
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**.
119119

@@ -141,7 +141,7 @@ You can use any text editor to write Go applications. We recommend using the lat
141141

142142
1. Create a new GO file named **text-translator.go** from the **translator-text-app** directory.
143143

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.
145145

146146
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:
147147

@@ -227,7 +227,7 @@ You can use any text editor to write Go applications. We recommend using the lat
227227
>
228228
> * You can also create a new file in your IDE named `TranslatorText.java` and save it to the `java` directory.
229229

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**.
231231

232232
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:
233233

@@ -290,7 +290,7 @@ You can use any text editor to write Go applications. We recommend using the lat
290290
>
291291
> * You can also create a new file named `index.js` in your IDE and save it to the `translator-text-app` directory.
292292

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**.
294294

295295
1. Once you've added the code sample to your application, run your program:
296296

@@ -611,6 +611,8 @@ After a successful call, you should see the following response:
611611
]
612612
```
613613

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+
614616
## Detect language
615617

616618
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

Comments
 (0)