Error codes
|
Error code |
Description |
Solution |
|
10001 |
Request timed out. |
Retry the request. |
|
10002 |
System error. |
Retry the request. |
|
10003 |
Failed to URL-decode the source text. |
Verify that the text is UTF-8 encoded and properly URL-encoded. |
|
10004 |
A required parameter is missing or has an invalid value. |
Refer to the API reference for parameter requirements. |
|
10005 |
The specified language pair is not supported. |
Verify that the language pair is in the list of supported languages. |
|
10006 |
Language identification failed. |
Verify that the input text for language identification is valid. |
|
10007 |
Translation failed. |
Verify that the source text is valid. |
|
10008 |
The source text exceeds the character limit. |
Ensure that the source text is no longer than 5,000 characters. |
|
19999 |
Unknown error. |
Contact customer support. |
Request character limit
For a single translation request, the source text must not exceed 5,000 characters. The service calculates the length using Java's String.length() <= 5000. For batch text translation, each text entry must not exceed 1,000 characters, and you can translate up to 50 entries per request. If you exceed the character limit, the request may time out and return an error.
If your text exceeds the limit, we recommend using Document Translation.
How are characters counted?
The character count is based on the length of the source text. The count includes punctuation, spaces, and HTML tags. Each Chinese character, English letter, and punctuation mark counts as one character. For example:
|
Language |
Source text |
Character count |
|
Chinese |
The weather is nice today! |
8 |
Other translation types
The service currently supports APIs for Text Translation, Image Translation (including general image and ID document translation), and Document Translation (for formats such as Word, PowerPoint, and Excel). We also offer a SaaS product at alynx-saas.alifanyi.com for end users to directly translate text, documents, images, videos, and speech.
Custom translation services
If you require this capability, contact our customer support team at mt_support@list.alibaba-inc.com or join our DingTalk group: 23369411.
Java SDK: SDK.InvalidRegionId error
-
Verify that the versions of aliyun-java-sdk-core and aliyun-java-sdk-alimt are correct.
-
Try rewriting your client initialization code.
An Alibaba Cloud account AccessKey grants full access to all API operations. We strongly recommend that you use a RAM user for API calls and daily operations.
To protect your resources, do not hard-code your AccessKey ID and AccessKey Secret into your project code. Leaked AccessKeys can compromise the security of all resources under your account. This example uses the Alibaba Cloud Credentials tool to manage AccessKeys for authentication. For information about how to configure credentials by using this tool or by setting an environment variable, refer to https://help.aliyun.com/document_detail/378659.html.
DefaultProfile profile = DefaultProfile.getProfile(
"cn-hangzhou", // region ID
EnvironmentVariableCredentialsProvider credentialsProvider = CredentialsProviderFactory.newEnvironmentVariableCredentialsProvider();// Read access credentials from an environment variable.
IAcsClient client = new DefaultAcsClient(profile);
TranslateGeneralRequest generalRequest = new TranslateGeneralRequest();// Create an API request and set parameters.
generalRequest.setMethod(MethodType.POST); // Set the request method to POST.
generalRequest.setFormatType("text"); // Format of the source text.
generalRequest.setSourceLanguage("zh"); // Source language.
generalRequest.setSourceText(URLEncoder.encode("你好","UTF-8")); // Source text.
generalRequest.setTargetLanguage("en"); // Target language.
System.out.println(JSON.toJSON(eCommerceResponse));
RAM user authorization errors
To grant permissions to a RAM user, create a permission policy in the Resource Access Management (RAM) console (https://ram.console.aliyun.com/policies).
Grant permissions to a RAM user
1. Log on to the Resource Access Management (RAM) console. In the left-side navigation pane, choose Identities > Users.
On the Users page, find the target RAM user and click Add Permissions in the Actions column.
2. Select System Policy. In the search box, enter mt. The system automatically finds the relevant policies. Select the required permission policy, add it to the Selected list on the right, and click OK.
The RAM user must log on with their RAM username and password.
For Authorization Scope, select Entire Cloud Account. In the search results, select the AliyunMTFullAccess policy, which grants permissions to manage Machine Translation (alimt).
Defining non-translatable terms
Source text may contain words, acronyms, or code that you do not want to translate. Machine Translation provides a custom dictionary feature that allows you to specify these non-translatable elements. Uploading a bilingual dictionary ensures that specific terms or phrases in the translation output match the terms you have defined. See the following example: 
Overdue payment and service suspension
On the China site, Machine Translation is billed hourly. If your account becomes overdue after a bill is generated, the service is suspended immediately. After 15 days of suspension, resources are released. To help ensure service continuity, we offer a non-shutdown privilege for overdue payments, which you must enable manually. For details, see Non-shutdown privilege for overdue payments.
On the International site, Machine Translation is billed daily and does not provide a non-shutdown privilege for overdue payments.