跳到主要内容
CNode

Baidut, package for Baidu translator both for Nodejs and Browser

分享
Hhaxpor发布于 10 年前
030140

I created this package, and would like to share. You can see at Baidut on NPM

Example usage

var Baidut = require("Baidut");
Baidut.builder
    .setAppId("2015063000000001")
    .setKey("12345678")
    .build();
Baidut.translate('สวัสดี', { http_request: true, get_method: true, from_lang: "th", to_lang: "en" })
    .then((result) => {
        console.log("translated text: " + result.trans_result[0].dst);
    }, (e) => {
        console.log(e.code + ": " + e.message);
    });

Thank you :)

查看回复

回复 (0)

暂无回复,成为第一个参与讨论的人。

参与回复

登录后即可参与回复。登录