Skip to content

Commit b0095b7

Browse files
committed
align formats
1 parent 67079c1 commit b0095b7

File tree

2 files changed

+91
-43
lines changed

2 files changed

+91
-43
lines changed

articles/ai-services/translator/text-translation/preview/translate-api.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ curl -X POST "https://api.cognitive.microsofttranslator.com/translate?api-versio
5656
***Windows***
5757

5858
```bash
59-
curl -X POST "https://<your-resource-name>.cognitiveservices.azure.com/translator/text/translate?api-version=2025-05-01-preview"^
59+
curl -X POST "https://<your-resource-name>.cognitiveservices.azure.com/translate?api-version=2025-05-01-preview"^
6060
-H "Ocp-Apim-Subscription-Key:<your-key>"^
6161
-H "Ocp-Apim-Subscription-Region:<your-resource-region>"^
6262
-H "Content-Type: application/json"^
@@ -65,7 +65,7 @@ curl -X POST "https://<your-resource-name>.cognitiveservices.azure.com/translato
6565
***Linux or macOS***
6666

6767
```bash
68-
curl -X POST "https://<your-resource-name>.cognitiveservices.azure.com/translator/text/translate?api-version=2025-05-01-preview" \
68+
curl -X POST "https://<your-resource-name>.cognitiveservices.azure.com/translate?api-version=2025-05-01-preview" \
6969
-H "Ocp-Apim-Subscription-Key:<your-key>" \
7070
-H "Ocp-Apim-Subscription-Region:<your-resource-region>" \
7171
-H "Content-Type: application/json" \
@@ -80,39 +80,39 @@ For more information on Translator service selected network and private endpoint
8080

8181
Request headers include:
8282

83-
| Headers | Description |
84-
| --- | --- |
85-
| **Authentication headers** | _Required request header_.<br/>See [available options for authentication](../reference/authentication.md). |
86-
| **Content-Type** | _Required request header_.<br/>Specifies the content type of the payload. Accepted values are: `application/json`; `charset=UTF-8`|
87-
| **Content-Length** | _Optional_.<br/>The length of the request body. |
88-
| **X-ClientTraceId** | _Optional_.<br/>A client-generated GUID to uniquely identify the request. You can omit this optional header if you include the trace ID in the query string using a query parameter named `ClientTraceId`. |
83+
| Headers | Required| Description |
84+
| --- | --- |---|
85+
| **Authentication headers** |****True****| *See* [available options for authentication](../reference/authentication.md). |
86+
| **Content-Type** |****True****| Specifies the content type of the payload. Accepted values are: `application/json`; `charset=UTF-8`|
87+
| **Content-Length** |False| The length of the request body. |
88+
| **X-ClientTraceId** |False| A client-generated GUID to uniquely identify the request. You can omit this optional header if you include the trace ID in the query string using a query parameter named `ClientTraceId`. |
8989

9090
#### Request parameters
9191

9292
Request parameters passed with the request are as follows:
9393

9494
| Parameter | Type | Required | Description |
9595
| --- | --- | --- | --- |
96-
|**api-version**|string|True|Version of the API requested by the client. Accepted value is 2025-05-01-preview.|
97-
|**text** | string | True | Source text for translation. |
96+
|**api-version**|string|**True**|Version of the API requested by the client. Accepted value is 2025-05-01-preview.|
97+
|**text** | string | **True** | Source text for translation. |
9898
|**language** | string | False | Specifies the language code for the `source` text. If not specified, the system autodetects the language of the source text. Accepted values are list of language code supported by the specified model. |
9999
| **script** | string | False | Specifies the script of the source text. |
100100
| **textType** | string | False | Defines whether the text being translated is plain text or HTML text. Any HTML needs to be a well-formed, complete element. Accepted values are: plain (default) or html. |
101101
||||
102-
| **targets** | array | True | User-specified values for the translated (target) text. |
103-
| **targets.language** | string | True |The language code for the translated (target) text *specified in the targets array*. Accepted values are [supported language](../../../language-support.md) codes for the translation operation.|
102+
| **targets** | array | **True** | User-specified values for the translated (target) text. |
103+
| **targets.language** | string | **True** |The language code for the translated (target) text *specified in the targets array*. Accepted values are [supported language](../../../language-support.md) codes for the translation operation.|
104104

105105
#### Targets array (user-specified values for translated text)
106106

107107
| Parameter | Type | Required? | Description |
108108
| --- | --- | --- | --- |
109-
| **targets.language** | string | True |The language code for the translated (`target`) text *specified in the `targets` array*. Accepted values are [supported language](../../../language-support.md) codes for the translation operation.|
109+
| **targets.language** | string | **True** |The language code for the translated (`target`) text *specified in the `targets` array*. Accepted values are [supported language](../../../language-support.md) codes for the translation operation.|
110110
| **targets.script** | string | False | Specify the script of the transliterated text. |
111111
|**targets.deploymentName** | string | False | &bullet; Default is `general`, which uses a neural machine translation (NMT) system.<br>&bullet; `your-model-name-gpt-4o-mini` is an example deployment name for the GPT-4o-mini model. For more information, *see* [Translate using GPT-4o mini and NMT deployments](translate-api.md#translate-using-gpt-4o-mini-deployment-and-nmt)<br>&bullet; `<categoryID>` uses the custom `NMT` model trained by customer. For more information, *see* [Train a custom model in Azure AI Foundry](../../custom-translator/azure-ai-foundry/how-to/train-model.md)<br> |
112112
| **targets.tone** | string | False | Desired tone of target translation. Accepted values are `formal`, `informal`, or `neutral`. |
113113
| **targets.gender** (For more information, *see* [Gender-specific translations](#gender-specific-translations))| string | False | Desired gender of target translation. Accepted values are `female`, `male`, or `neutral`.|
114114
| **targets.adaptiveDatasetId** | string | False | Reference dataset ID having sentence pair to generate adaptive customized translation. The maximum number of reference text pairs to generate adaptive customized translation is five (5).|
115-
| **targets.allowFallback** | string | False | If the desired model doesn't support a particular pair of source and target languages, an alternative approach may be employed. In such cases, the service may default to utilizing a general system as a substitute. This action ensures that translations can still be provided even when the preferred model is unavailable. Default is `true`. If `false` system returns an error if language pair isn't supported. |
115+
| **targets.allowFallback** | string | False | If the desired model doesn't support a particular pair of source and target languages, an alternative approach may be employed. In such cases, the service may default to utilizing a general system as a substitute. This action ensures that translations can still be provided even when the preferred model is unavailable. Default is `True`. If `False` system returns an error if language pair isn't supported. |
116116
| **targets.referenceTextPairs** | string | False | Reference text pairs to generate adaptive customized translation. |
117117
| **targets.referenceTextPairs.source** | string | False | Source text in reference text pair. If provided, `adaptiveDatasetId` is ignored. |
118118
| **targets.referenceTextPairs.target** | string | False | Target text in reference text pair. |

articles/ai-services/translator/text-translation/preview/transliterate-api.md

Lines changed: 77 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,75 @@ The Text transliteration API maps your source language script or alphabet to a t
1616

1717
## Request URL
1818

19-
Send a `POST` request to:
19+
### Global endpoint configuration
20+
21+
**Send a `POST` request to**:
2022

2123
```bash
22-
https://api.cognitive.microsofttranslator.com/transliterate?api-version=2025-05-01-preview
24+
curl -X POST https://api.cognitive.microsofttranslator.com/transliterate?api-version=2025-05-01-preview
25+
-H "Ocp-Apim-Subscription-Key:<your-key>" ^
26+
-H "Ocp-Apim-Subscription-Region:<your-resource-region>" ^
27+
-H "Content-Type: application/json" ^
28+
-d "<your-request-body>"
2329
```
2430

25-
For more information on Translator service selected network and private endpoint configuration and support, *see* [**Virtual Network Support**](../reference/authentication.md#virtual-network-support).
31+
***Linux or macOS***
2632

27-
## Request parameters
33+
```bash
34+
curl -X POST "https://api.cognitive.microsofttranslator.com/transliterate?api-version=2025-05-01-preview" \
35+
-H "Ocp-Apim-Subscription-Key:<your-key>" \
36+
-H "Ocp-Apim-Subscription-Region:<your-resource-region>" \
37+
-H "Content-Type: application/json" \
38+
-d "<your-request-body>"
39+
```
40+
### Custom endpoint configuration
2841

29-
Request parameters passed on the query string are:
42+
Your custom domain endpoint is a URL formatted with your resource name and hostname and is available in the Azure portal. When you created your Translator resource, the value that you entered in the `Name` field is the custom domain name parameter for the endpoint.
3043

31-
| Query parameter | Description |
32-
| --- | --- |
33-
| api-version | *Required parameter*.<br/>Version of the API requested by the client. Value must be `3.0`. |
34-
| language | *Required parameter*.<br/>Specifies the language of the text to convert from one script to another. Possible languages are listed in the `transliteration` scope obtained by querying the service for its [supported languages](get-languages.md). |
35-
| fromScript | *Required parameter*.<br/>Specifies the script used by the input text. Look up [supported languages](get-languages.md) using the `transliteration` scope, to find input scripts available for the selected language. |
36-
| toScript | *Required parameter*.<br/>Specifies the output script. Look up [supported languages](get-languages.md) using the `transliteration` scope, to find output scripts available for the selected combination of input language and input script. |
44+
**Send a `POST` request**:
45+
46+
***Windows***
47+
48+
```bash
49+
curl -X POST "https://<your-resource-name>.cognitiveservices.azure.com//transliterate?api-version=2025-05-01-preview"^
50+
-H "Ocp-Apim-Subscription-Key:<your-key>"^
51+
-H "Ocp-Apim-Subscription-Region:<your-resource-region>"^
52+
-H "Content-Type: application/json"^
53+
-d "<your-request-body>"
54+
```
55+
***Linux or macOS***
56+
57+
```bash
58+
curl -X POST "https://<your-resource-name>.cognitiveservices.azure.com//transliterate?api-version=2025-05-01-preview" \
59+
-H "Ocp-Apim-Subscription-Key:<your-key>" \
60+
-H "Ocp-Apim-Subscription-Region:<your-resource-region>" \
61+
-H "Content-Type: application/json" \
62+
-d "<your-request-body>"
63+
```
64+
65+
### Private endpoint
66+
67+
For more information on Translator service selected network and private endpoint configuration and support, *see* [**Virtual Network Support**](../reference/authentication.md).
3768

3869
## Request headers
3970

40-
| Headers | Description |
41-
| --- | --- |
42-
| Authentication headers | _Required request header_.<br/>See [available options for authentication](../../../authentication.md). |
43-
| Content-Type | _Required request header_.<br/>Specifies the content type of the payload. Possible values are: `application/json` |
44-
| Content-Length | _Optional_.<br/>The length of the request body. |
45-
| X-ClientTraceId | _Optional_.<br/>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`. |
71+
| Headers | Required| Description |
72+
| --- | --- |---|
73+
| **Authentication headers** |**True**| *See* [available options for authentication](../reference/authentication.md). |
74+
| **Content-Type** |**True**| Specifies the content type of the payload. Accepted values are: `application/json`; `charset=UTF-8`|
75+
| **Content-Length** |False| The length of the request body. |
76+
| **X-ClientTraceId** |False| A client-generated GUID to uniquely identify the request. You can omit this optional header if you include the trace ID in the query string using a query parameter named `ClientTraceId`. |
77+
78+
## Request parameters
79+
80+
Request parameters passed on the query string areas are as follows:
81+
82+
| Parameter |Type| Required | Description |
83+
| --- | --- |---|---|
84+
|**api-version**|string|**True**|Version of the API requested by the client. Accepted value is 2025-05-01-preview.|
85+
| **fromScript**| string|**True**| Specifies the script used by the input text. Look up [supported languages](get-languages.md) using the `transliteration` scope, to find input scripts available for the selected language. |
86+
| **toScript** |string| **True**| Specifies the output script. Look up [supported languages](get-languages.md) using the `transliteration` scope, to find output scripts available for the selected combination of input language and input script. |
87+
|**language** | string | False | Specifies the language code for the `source` text. If not specified, the system autodetects the language of the source text. Accepted values are list of language code supported by the specified model. |
4688

4789
## Request body
4890

@@ -82,7 +124,21 @@ An example JSON response is:
82124

83125
| Headers | Description |
84126
| --- | --- |
85-
| X-RequestId | Value generated by the service to identify the request and used for troubleshooting purposes. |
127+
| **X-RequestId** | Value generated by the service to identify the request and used for troubleshooting purposes. |
128+
129+
## Example
130+
131+
The following example shows how to convert two Japanese strings into Romanized Japanese.
132+
133+
```bash
134+
curl -X POST "https://api.cognitive.microsofttranslator.com/transliterate?api-version=2025-05-01-preview&language=ja&fromScript=Jpan&toScript=Latn" -H "X-ClientTraceId: 875030C7-5380-40B8-8A03-63DACCF69C11" -H "Ocp-Apim-Subscription-Key: <client-secret>" -H "Content-Type: application/json" -d @request.txt
135+
```
136+
137+
The JSON payload for the request in this example:
138+
139+
```json
140+
[{"text":"こんにちは","script":"jpan"},{"text":"さようなら","script":"jpan"}]
141+
```
86142

87143
## Response status codes
88144

@@ -100,17 +156,9 @@ The following are the possible HTTP status codes that a request returns.
100156

101157
If an error occurs, the request also returns a JSON error response. The error code is a 6-digit number combining the 3-digit HTTP status code followed by a 3-digit number to further categorize the error. Common error codes can be found on the [Status code reference page](../reference/status-response-codes.md).
102158

103-
## Examples
104-
105-
The following example shows how to convert two Japanese strings into Romanized Japanese.
106-
107-
The JSON payload for the request in this example:
108159

109-
```json
110-
[{"text":"こんにちは","script":"jpan"},{"text":"さようなら","script":"jpan"}]
111-
```
160+
## Next steps
112161

162+
> [!div class="nextstepaction"]
163+
> [View 2025-05-01-preview migration guide](../how-to/migrate-to-preview.md)
113164
114-
```
115-
curl -X POST "https://api.cognitive.microsofttranslator.com/transliterate?api-version=2025-05-01-preview&language=ja&fromScript=Jpan&toScript=Latn" -H "X-ClientTraceId: 875030C7-5380-40B8-8A03-63DACCF69C11" -H "Ocp-Apim-Subscription-Key: <client-secret>" -H "Content-Type: application/json" -d @request.txt
116-
```

0 commit comments

Comments
 (0)