Domain name for API request: tmt.intl.tencentcloudapi.com.
This API is used to translate text in multiple language pairs, such as Chinese-English.
Note: We recommend that you simplify your development with the SDK integration mode. For how to use the SDK, see Section 5 "Developer Resources".
A maximum of 5 requests can be initiated per second for this API.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
Parameter Name | Required | Type | Description |
---|---|---|---|
Action | Yes | String | Common Params. The value used for this API: TextTranslate. |
Version | Yes | String | Common Params. The value used for this API: 2018-03-21. |
Region | Yes | String | Common Params. For more information, please see the list of regions supported by the product. |
SourceText | Yes | String | The texts to be translated, which must be encoded in UTF-8 and can contain up to 2,000 characters in a request. For non-pure texts such as those with HTML tags, the translation may fail. |
Source | Yes | String | Supported source languages: auto: Automatic language detection zh: Simplified Chinese zh_TW: Traditional Chinese en: English ja: Japanese fr: French es: Spanish it: Italian de: German tr: Turkish ru: Russian pt: Portuguese vi: Vietnamese id: Bahasa Indonesian th: Thai ms: Malay ar: Arabic hi: Hindi |
Target | Yes | String | Supported target languages for the above source languages: |
ProjectId | Yes | Integer | The project ID, which can be obtained from Console -> Account Center -> Project Management. If no one is set, enter the default project ID 0 . |
UntranslatedText | No | String | The parameter used to mark the text content that needs to remain untranslated, such as special symbols and names of people and places. You can set only one word for this parameter in each request. Only nouns (like names of people and places) are supported, and verbs or phrases may cause poor translation outcomes. |
TermRepoIDList.N | No | Array of String | |
SentRepoIDList.N | No | Array of String |
Parameter Name | Type | Description |
---|---|---|
TargetText | String | The translation outcome. |
Source | String | The source language. See the request parameter Source for details. |
Target | String | The target language. See the request parameter Target for details. |
RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
TextTranslate from English to Chinese
POST / HTTP/1.1
Host: tmt.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: TextTranslate
<common request parameters>
{
"SourceText": "hello",
"Source": "en",
"Target": "zh",
"ProjectId": 0
}
{
"Response": {
"TargetText": "你好",
"Source": "en",
"Target": "zh",
"RequestId": "000ee211-f19e-4a34-a214-e2bb1122d248"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
Error Code | Description |
---|---|
FailedOperation.ErrorUserArea | |
FailedOperation.LanguageRecognitionErr | |
FailedOperation.NoFreeAmount | The free quota for this month is used up. To continue to use the service, you need to upgrade to a paid account in the TMT console. |
FailedOperation.RequestAiLabErr | |
FailedOperation.ServiceIsolate | The service is suspended due to overdue payments. Top up your account first. |
FailedOperation.StopUsing | |
FailedOperation.UserNotRegistered | The service is not activated. Activate it in the TMT console first. |
InternalError | Internal error. |
InternalError.BackendTimeout | Backend service timeout. Please try again later. |
InternalError.ErrorGetRoute | |
InternalError.ErrorUnknown | Unknown error. |
InternalError.RequestFailed | Request failed. |
InvalidParameter | Invalid parameter. |
InvalidParameter.MissingParameter | Invalid parameter. |
InvalidParameterValue | |
LimitExceeded | The quota limit is reached. |
LimitExceeded.LimitedAccessFrequency | The request frequency limit is reached. |
MissingParameter | Missing parameter. |
RequestLimitExceeded.UinLimitExceeded | |
UnauthorizedOperation.ActionNotFound | Incorrect name entered in the Action field. |
UnsupportedOperation | Unsupported operation. |
UnsupportedOperation.TextTooLong | The text length limit (2,000 characters) for a request is reached. |
UnsupportedOperation.UnSupportedTargetLanguage | Unsupported target language. Please refer to the supported language list. |
UnsupportedOperation.UnsupportedLanguage | Unsupported language. Please refer to the supported language list. |
UnsupportedOperation.UnsupportedSourceLanguage | Unsupported source language. Please refer to the supported language list. |
本页内容是否解决了您的问题?