@jswork/next-baidu-fanyi
v1.1.3
Published
Baidu fangyi api wrapper.
Downloads
26
Readme
next-baidu-fanyi
Baidu fangyi api wrapper.
installation
npm install -S @jswork/next-baidu-fanyi
apis
| api | params | description | | --------- | ------ | --------------- | | translate | - | Get translation |
options
| name | default | description | | ------ | ------- | ------------------- | | delay | 1000 | Call fn duration. | | from | zh | from which language | | to | en | to which language | | appid | - | - | | secret | - | - | | q | - | keywords |
usage
import NxBaiduFanyi from '@jswork/next-baidu-fanyi';
// code goes here:
NxBaiduFanyi.translate({ q: '苹果', from:'zh', to:'en' }).then((res) => {
/*
// res:
{
from: 'zh',
to: 'en',
trans_result: [{ src: '苹果', dst: 'Apple' }]
}
*/
});
resources
- https://api.fanyi.baidu.com/doc/21
license
Code released under the MIT license.