yd-trans

0.0.10 • Public • Published

yd-trans

yd-trans A very very simple translator CLI that (for now) only does cn to en/fr/kr/jp 'long' sentence translation.

npm NPM JavaScript Style Guide: Standard

NOTE: sometimes the result may be weird... Just try typing in something different. This issue will hopefully be addressed in the next few releases...

Install

Install

npm install yd-trans
yarn add yd-trans

Install Globally

npm install -g yd-trans
yarn global add yd-trans

Usage

const translator = require('yd-trans')

translator
  .translate('你微笑时很美')
  .from('Chinese')
  .into('English')
  .start()
  .then(console.log)
  .catch(e => {
    // error handling
  })

output:

{ 
  src: '你微笑时很美',
  dst: 'You look beautiful when you smile' 
}

Global Usage

$ yd 你微笑时很美
$ yd --to=jap 你微笑时很美
$ yd --to=fr 你微笑时很美
Usage: yd <sentence> [options]

Options:
  -V --version 显示版本号 (Version number)

  -h, --help   显示帮助信息

  -T, --to     选择目标语言 (Choose destination language)

示例:
  yd 你微笑时很美
  yd --to=jp 你微笑时很美
  yd -T=ko 你微笑时很美

TODO

  • [ ] Add 'translation link' support (translate from Chinese to English and then translate back to Chinese then to French then to English ...).

    Use case: This can be used to reduce repetition rate of thesis you are writing.

  • [ ] Use youdao's official API instead of scraping this site.

  • [ ] use Git & GitHub to manage version history, most likely starting from version 0.1.0

  • [ ] Future plans (maybe?)

    • [ ] potentially add other vendor support (baidu, iciba etc.)
    • [ ] migrate this package to maybe @atimidguy/translator

Package Sidebar

Install

npm i yd-trans

Weekly Downloads

4

Version

0.0.10

License

MIT

Unpacked Size

8.04 kB

Total Files

14

Last publish

Collaborators

  • atimidguy