Call Machine Translation Professional Edition to obtain translation results.
1. The QPS limit for calling the interface is 50. If you have any expansion requirements, please contact us. DingTalk group number: 21983957
2. Before you call this operation, make sure that you fully understand the billing methods and pricing of Professional Translation.
Debugging
Request parameters
Parameter | Type | Required | Example | Message |
Action | String | Yes | Translate | The operation that you want to perform. Value:Translate |
FormatType | String | Yes | text | Translated text format, html (web page format. Setting this parameter will process the text to be translated and the translated text in html format), text (text format. If you set this parameter, the text to be translated and the translated results will not be text format processed, but will be processed as pure text format. |
Scene | String | Yes | title | Valid values: title, description, communication, medical, social, and finance. |
SourceLanguage | String | Yes | zh | Source language |
SourceText | String | Yes | Hello | Content to be translated |
TargetLanguage | String | Yes | en | Target language |
Scenario
We have different engines for different scenarios. Each engine is specially optimized and can be controlled by scene parameters (optional values for scenarios: commodity title (title) , commodity description (description) , commodity communication (communication) , medical (medical) , social (social) , and finance (finance)
Commodity title: using Ali e-commerce title data, trained separately, the translation title is especially good.
Detailed description of goods: it is better to use the detailed description data of Ali goods and train them separately.
Commodity communication: in the case of e-commerce buyers and sellers, the translation effect will be very good.
Medical: It is an engine trained separately for medical literature, terminology and drugs. In this scenario, the translation effect will be very good.
Social: For colloquial translation, the translation result will be better in this scenario.
Finance: Translations for the Financial Sector
Response parameters
Parameter | Type | Example | Message |
Code | Integer | 200 | Error codes |
Data | Struct | Response parameters | |
Translated | String | Hello | The translated string. |
WordCount | String | 10 | Total number of words |
DetectedLanguage | String | zh | zhThe source language code after language identification when the source language is passed into auto |
Message | String | success | The returned message. |
RequestId | String | 86D18195-D89C-4C8C-9DC4-5FCE789CE6D5 | The ID of the request. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=Translate
&FormatType=text
&Scene=title
&SourceLanguage=en
&SourceText=Hello
&TargetLanguage=zh
&<Common request parameters>Sample success response
XML format
<TranslateResponse>
<Data>
<Translated>Hello</Translated>
</Data>
<RequestId>22A7F1D3-57AF-4F64-B2A6-5E1A180CF6B1</RequestId>
<Code>200</Code>
</TranslateResponse>JSON format
{
"TranslateResponse": {
"Data": {
"Translated": "Hello"
},
"RequestId": "22A7F1D3-57AF-4F64-B2A6-5E1A180CF6B1",
"Code": 200
}
}Error codes
HttpCode | Error code | Error message | Remarks |
101 | 10001 | The request has timed out. | The request timed out. |
102 | 10002 | A system error occurred. | System error. |
103 | 10003 | An error occurred while decoding the URL. Verify that the specified URL is encoded. | Failed to decode the original text. Check whether the original text is UrlEncode. |
104 | 10004 | Some required parameters are missing. | The error message returned when the application ID is not specified. |
105 | 10005 | The specified language pair is not supported. | The language item is not supported. |
106 | 10006 | An error occurred while detecting the language. | The error message returned when the system fails to recognize the string. |
107 | 10007 | An error occurred while translating. | The error message returned when the translation fails. |
108 | 10008 | The specified string is too long. | characters in length too long |
199 | 19999 | An unknown error occurred. | An unknown error occurred. |
109 | 10009 | The RAM user has no permissions. | The RAM user has no permissions. |
110 | 10010 | The account does not activate the service. | The account does not activate the service. |
111 | 10011 | The sub-account service failed. | Sub-account service failure |
112 | 10012 | Translation service call failed | Translation service call failed |
113 | 10013 | The account service is not activated or the payment is overdue. | The account service is not activated or the payment is overdue. |
For a list of error codes, see Service error codes.