0.1.2 • Published 4 years ago
@wordway/translate-api v0.1.2
@wordway/translate-api
Quick Start
Installation
$ yarn add @wordway/translate-api
Now, enjoy!
const icibaEngine = new IcibaEngine({ key: '<Your key>'});
const youdaoEngine = new YoudaoEngine({ appKey: '<Your appKey>', appSecret: '<Your appSecret>'});
const client = new Translate([icibaEngine, youdaoEngine]);
const lookUpResult = await client.engine('youdao').lookUp('hello');
Specification
LookUpResult
name | required | type | description |
---|---|---|---|
engine | YES | string | 字典引擎 |
word | YES | string | 单词 |
tip | NO | string | 提示 |
definitions | NO | Array<any> | 定义(基本释义) |
ukIpa | NO | string | 英语-英式音标 |
ukPronunciationUrl | NO | string | 英语-英式发音链接 |
usIpa | NO | string | 英语-美式音标 |
usPronunciationUrl | NO | string | 英语-美式发音链接 |
images | NO | Array<any> | 图片 |
phrases | NO | Array<any> | 短语 |
tenses | NO | Array<any> | 时态 |
sentences | NO | Array<any> | 例句 |
sourceText | NO | string | 原始文本 |
sourceAudioUrl | NO | string | 原始音频链接 |
targetText | NO | string | 目标文本 |
targetAudioUrl | NO | string | 目标音频链接 |
originData | NO | any | 原始数据(翻译引擎返回的数据) |
Local Development
Below is a list of commands you will probably find useful.
npm start
or yarn start
Runs the project in development/watch mode. Your project will be rebuilt upon changes. TSDX has a special logger for you convenience. Error messages are pretty printed and formatted for compatibility VS Code's Problems tab.
Your library will be rebuilt if you make edits.
npm run build
or yarn build
Bundles the package to the dist
folder.
The package is optimized and bundled with Rollup into multiple formats (CommonJS, UMD, and ES Module).
npm test
or yarn test
Runs the test watcher (Jest) in an interactive mode. By default, runs tests related to files changed since the last commit.
License
MIT License
Copyright (c) 2019 LiJianying <lijy91@foxmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.