文档

GetBatchTranslate - 机器批量翻译调用指南

更新时间:

机器批量翻译,支持多段文本进行翻译。

接口说明

1、调用接口 QPS 限制 50,如有扩展需求,请与我们联系钉钉群号:23369411 2、批量翻译单条字符长度上限是 1000 字符,一次最多可翻译 50 条,若超出上限,可以保存成文件,使用文档翻译 3、请确保在使用该接口前,已充分了解通用版和专业版翻译产品的收费方式和价格 4、批量翻译接口参考阿里云 OpenAPI 开发者门户调试调用

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

当前API暂无授权信息透出。

请求参数

名称类型必填描述示例值
FormatTypestring

翻译文本的格式,html( 网页格式。设置此参数将对待翻译文本以及翻译后文本按照 html 格式进行处理)、text(文本格式。设置此参数将对传入待翻译文本以及翻译后结果不做文本格式处理,统一按纯文本格式处理。

text
TargetLanguagestring

译文语言参考语言 code

zh
SourceLanguagestring

原文语言参考语言 code

en
Scenestring
  • 专业版本支持的场景:商品标题(title),商品描述(description),商品沟通(communication),医疗(medical),社交(social)

  • 通用版本支持的场景:general

general
ApiTypestring
  • 版本类型,必须选择一个版本

  • 通用版本:translate_standard

  • 专业版本:translate_ecommerce

translate_standard
SourceTextstring

json 数据格式

key:唯一的标记 id,用于翻译结果拿到对应的 id,对应上原文

value:待翻译的内容

具体格式如下: { "11": "hello boy", "12": "go home", "13": "we can" }

说明 待翻译的条数不能超过 50 单条翻译字符数不能超过 1000 字符 总字符数不能超过 8000 字符 key 不会计入翻译的字符 待翻译的内容中,标点、空格、html 标签均会计入字符
{"11":"hello boy","12":"go home","13":"we can"}

返回参数

名称类型描述示例值
object
Codeinteger

错误码

200
Messagestring

返回信息

success
RequestIdstring

请求的唯一 id,用于后续排查问题使用

86D18195-D89C-4C8C-9DC4-5FCE789CE6D5
TranslatedListobject []
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错误码错误信息描述
101System.RequestTimeOutThe request has timed out.请求超时
102System.ErrorA system error occurred.系统错误
103System.UrlDecodingErrorAn error occurred while decoding the URL. Verify that the specified URL is encoded.URL编码错误
104System.ParameterErrorSome required parameters are missing.参数错误
105System.LanguageNotSupportedThe specified language pair is not supported.该语向不支持
106System.LanguageDetectErrorAn error occurred while detecting the language.语种识别错误
107System.TranslateErrorAn error occurred while translating.翻译错误
108System.StringTooLongThe maximum length of the specified string is exceeded.字符过长
109System.SubNotPermissionThe sub account is not authorized to perform the operation.子账号没有权限
109System.subNotPermissionThe sub-account is not authorized to perform the operation.子账号没有权限
110System.AccountNotActivatedThe account has not activated the service.账号没有开通服务
111System.SubServiceFailedSub-account service failed.子账号服务失败
112System.TranslateServiceCallFailedFailed to call the translation service.翻译服务调用失败
113System.AccountNotActivatedOrInArrearsThe service is not activated or the account has an outstanding balance.账号服务没有开通或者欠费
199System.unknownErrorAn unknown error occurred.未知错误
199System.UnknownErrorAn unknown system error occurred.-

访问错误中心查看更多错误码。

变更历史

变更时间变更内容概要操作
暂无变更历史
  • 本页导读 (0)
文档反馈