0.1.2 • Published 4 years ago

@wordway/translate-api v0.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

@wordway/translate-api

npm version npm Join the chat

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

namerequiredtypedescription
engineYESstring字典引擎
wordYESstring单词
tipNOstring提示
definitionsNOArray<any>定义(基本释义)
ukIpaNOstring英语-英式音标
ukPronunciationUrlNOstring英语-英式发音链接
usIpaNOstring英语-美式音标
usPronunciationUrlNOstring英语-美式发音链接
imagesNOArray<any>图片
phrasesNOArray<any>短语
tensesNOArray<any>时态
sentencesNOArray<any>例句
sourceTextNOstring原始文本
sourceAudioUrlNOstring原始音频链接
targetTextNOstring目标文本
targetAudioUrlNOstring目标音频链接
originDataNOany原始数据(翻译引擎返回的数据)

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.