Quantcast
Channel: CNode:Node.js专业中文社区
Viewing all articles
Browse latest Browse all 14821

Baidut, package for Baidu translator both for Nodejs and Browser

$
0
0

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 :)


Viewing all articles
Browse latest Browse all 14821

Trending Articles