机器批量翻译,支持多段文本进行翻译。
接口说明
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
alimt:GetBatchTranslate |
get |
*全部资源
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| FormatType |
string |
是 |
翻译文本的格式,html( 网页格式。设置此参数将对待翻译文本以及翻译后文本按照 html 格式进行处理)、text(文本格式。设置此参数将对传入待翻译文本以及翻译后结果不做文本格式处理,统一按纯文本格式处理。 |
text |
| TargetLanguage |
string |
是 |
译文语言参考语言 code |
zh |
| SourceLanguage |
string |
是 |
原文语言参考语言 code |
en |
| Scene |
string |
是 |
|
general |
| ApiType |
string |
是 |
|
translate_standard |
| SourceText |
string |
是 |
json 数据格式 key:唯一的标记 id,用于翻译结果拿到对应的 id,对应上原文 value:待翻译的内容 具体格式如下:
说明
待翻译的条数不能超过 50 单条翻译字符数不能超过 1000 字符 总字符数不能超过 8000 字符 key 不会计入翻译的字符 待翻译的内容中,标点、空格、html 标签均会计入字符 |
{"11":"hello boy","12":"go home","13":"we can"} |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| Code |
integer |
错误码 |
200 |
| Message |
string |
返回信息 |
success |
| RequestId |
string |
请求的唯一 id,用于后续排查问题使用 |
86D18195-D89C-4C8C-9DC4-5FCE789CE6D5 |
| TranslatedList |
array<object> |
批量翻译结果列表。 |
[{"code":"200","wordCount":"9","detectedLanguage":"en","index":"11","translated":"你好男孩"}] |
|
object |
返回结果,json 格式 code:单条翻译的状态码 wordCount:原文的字符数 detectedLanguage:源语言传入 auto 时,语种识别后的源语言代码 index:入参时候的 key,唯一 id,用于对应到原文 translated:翻译结果 |
[ { "code": "200", "wordCount": "9", "detectedLanguage": "en" "index": "11", "translated": "你好男孩" }, { "code": "200", "wordCount": "7", "detectedLanguage": "en" "index": "12", "translated": "回家" }, { "code": "200", "wordCount": "6", "detectedLanguage": "en" "index": "13", "translated": "我们可以" } ] |
示例
正常返回示例
JSON格式
{
"Code": 200,
"Message": "success",
"RequestId": "86D18195-D89C-4C8C-9DC4-5FCE789CE6D5",
"TranslatedList": [
{
"test": "test",
"test2": 1
}
]
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 110 | System.AccountNotActivated | The account has not activated the service. | |
| 111 | System.SubServiceFailed | Sub-account service failed. | |
| 199 | System.unknownError | An unknown error occurred. | |
| 199 | System.UnknownError | An unknown system error occurred. | |
| 101 | System.RequestTimeOut | The request has timed out. | |
| 112 | System.TranslateServiceCallFailed | Failed to call the translation service. | |
| 102 | System.Error | A system error occurred. | |
| 113 | System.AccountNotActivatedOrInArrears | The service is not activated or the account has an outstanding balance. | |
| 103 | System.UrlDecodingError | An error occurred while decoding the URL. Verify that the specified URL is encoded. | |
| 104 | System.ParameterError | Some required parameters are missing. | |
| 105 | System.LanguageNotSupported | The specified language pair is not supported. | |
| 106 | System.LanguageDetectError | An error occurred while detecting the language. | |
| 107 | System.TranslateError | An error occurred while translating. | |
| 108 | System.StringTooLong | The maximum length of the specified string is exceeded. | |
| 109 | System.SubNotPermission | The sub account is not authorized to perform the operation. | |
| 109 | System.subNotPermission | The sub-account is not authorized to perform the operation. |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。