各平台免费翻译API

  • google

http://translate.google.cn/translate_a/single?client=gtx&dt=t&dj=1&ie=UTF-8&sl=auto&tl=zh_TW&q=calculate

{
    "sentences": [
        {
            "trans": "計算",
            "orig": "calculate",
            "backend": 1
        }
    ],
    "src": "en",
    "confidence": 0.9609375,
    "ld_result": {
        "srclangs": [
            "en"
        ],
        "srclangs_confidences": [
            0.9609375
        ],
        "extended_srclangs": [
            "en"
        ]
    }
}
  • Bing

http://api.microsofttranslator.com/v2/Http.svc/Translate?appId=A4D660A48A6A97CCA791C34935E4C02BBB1BEC1C&from=&to=en&text=考勤计算

<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">Attendance calculation</string>

不添加from参数或者from为空都自动检测语言

  • Baidu

首先去https://fanyi-api.baidu.com/api/trans/product/desktop免费注册,页面最下面可以看到APP ID和密钥,然后把下面地址中的appid替换为APP ID,salt随便写,sign为"APPID+查询字符+salt+密钥"经过MD5加密后的字符,https://fanyi-api.baidu.com/api/trans/product/apidoc有详细介绍

http://api.fanyi.baidu.com/api/trans/vip/translate?appid=20200615000495866&salt=baidu&sign=ABCD&from=auto&to=cht&q=Calculation

{
    "from": "en",
    "to": "cht",
    "domain": "all",
    "type": 2,
    "status": 0,
    "data": [
        {
            "dst": "計算",
            "prefixWrap": 0,
            "src": "Calculation",
            "relation": [],
            "result": [
                [
                    0,
                    "計算",
                    [
                        "0|6"
                    ],
                    [],
                    [
                        "0|6"
                    ],
                    [
                        "0|6"
                    ]
                ]
            ]
        }
    ]
}

v2transapi和transapi都已经失效

  • Youdao

http://fanyi.youdao.com/translate?&doctype=json&type=AUTO&i=计算

{
    "type": "ZH_CN2EN",
    "errorCode": 0,
    "elapsedTime": 1,
    "translateResult": [
        [
            {
                "src": "计算",
                "tgt": "To calculate"
            }
        ]
    ]
}

type的类型有:

ZH_CN2EN 中文 » 英语
ZH_CN2JA 中文 » 日语
ZH_CN2KR 中文 » 韩语
ZH_CN2FR 中文 » 法语
ZH_CN2RU 中文 » 俄语
ZH_CN2SP 中文 » 西语
EN2ZH_CN 英语 » 中文
JA2ZH_CN 日语 » 中文
KR2ZH_CN 韩语 » 中文
FR2ZH_CN 法语 » 中文
RU2ZH_CN 俄语 » 中文
SP2ZH_CN 西语 » 中文



 

posted @ 2018-08-03 14:47  codeIsArt  阅读(72651)  评论(14编辑  收藏  举报