Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wyyxdgm/i18n-baidu
i18n via baidu api
https://github.com/wyyxdgm/i18n-baidu
i18n i18n-node js npm npm-package
Last synced: about 7 hours ago
JSON representation
i18n via baidu api
- Host: GitHub
- URL: https://github.com/wyyxdgm/i18n-baidu
- Owner: wyyxdgm
- Created: 2018-08-24T10:04:58.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-09-11T01:58:21.000Z (about 6 years ago)
- Last Synced: 2024-11-10T21:13:47.127Z (7 days ago)
- Topics: i18n, i18n-node, js, npm, npm-package
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# i18n-baidu
通过百度的api实现i18n多语言翻译、npm package
## 使用方法
1. npm包安装
```
npm install i18n-baidu
```2. 在[百度翻译官网](http://api.fanyi.baidu.com/api/trans/product/index)申请接入,获取:AppId、密钥
3. Snippets,覆盖代码中的 `yourKey`, `yourSecret`
```
const I18nBaidu = require('i18n-baidu');
let i18nBaidu = new I18nBaidu(yourKey, yourSecret);let postData = {
q: 'a group of men standing next to each other\n ha ha ',
from: 'en',
to: 'zh'
}i18nBaidu.translate(postData, (res) => {
if (res) {
console.log(res);
}
});
```