dict-tiny

- 7 mins

Dict-tiny

PyPI version GitHub Workflow Status License: MIT Downloads

A command line translator that integrates with Google Translate, DeepL Translator and youdao.com

Just for fun :)

Installation

You can install dict-tiny via pip. (Python 3 only)

$ pip install dict-tiny

Upgrading

$ pip install --upgrade dict-tiny

Usage

DeepL Translator

Adding -d / --deepl to use DeepL Translator API:

$ dict-tiny -d easy come easy go
>>> DeepL Translator
detected language: EN
input: easy come easy go
output: 来得容易去得快

Specify the target translation language as French via the --target-language:

$ dict-tiny -d easy come easy go  --target-language FR
>>> DeepL Translator
detected language: EN
input: easy come easy go
output: ça va, ça vient

Note:

Google Translation

Adding -g / --google to use Google Translation API:

$ dict-tiny -g book
>>> Google Translate
detected language: en
input: book
output: 书

Adding --target-language to specify what language you want to translate into:

$ dict-tiny -g book --target-language japanese
>>> Google Translate
detected language: en
input: book
output: 本

Adding --source-language to specify what language you want to translate, but most of the time you don’t need to do this because the API will automatically detect the language type.

So, of course, you can use it to detect the language type:

$ dict-tiny --detect-language book
>>> Google detect language
confidence: 1
input: book
language: en
name: English

Note:

Target language

Default behavior

$ dict-tiny book
book  英[bʊk]美[bʊk]
===================
n. 书籍;卷;账簿;名册;工作簿
vt. 预订;登记
n. (Book)人名;(中)卜(广东话·威妥玛);(朝)北;(英)布
$ dict-tiny 书
书  [shū]
=========
n.book;letter;script
vt.write

Use -m/--more to get more detail translation for word:

$ dict-tiny 曾经 -m
曾经  [céng jīng]
=================
adv.once;ever

more detail:
======== 副词 ========
1:
  (表示有过某些行为或情况) once:
  He once lived in Shanghai.
  他曾经在上海住过。
  She has taken part in a major battle for oil.
  她曾经参加过石油大会战。
$ dict-tiny dictionary -m
dictionary  英['dɪkʃ(ə)n(ə)rɪ]美['dɪkʃə'nɛri]
=============================================
n. 字典;词典

more detail (collins):
======== N-COUNT 可数名词 ========
 · 词典

A dictionary is a book in which the words and phrases of a language are listed alphabetically, together with their meanings or their translations in another language.


 例: ...a Spanish-English dictionary.
     …一本西班牙语—英语词典。

Note:

Translate the word in clipboard

Using -c/--clipboard to translate the word in clipboard:

$ dict-tiny -c
命令行  
======
command line

You can use both -g and -c.

$ dict-tiny -g -c
>>> Google Translate
input: clipboard
output: 剪贴板
detected language: en

Note:

License

MIT

tumblr weibo rss facebook twitter github gitlab youtube mail spotify lastfm instagram linkedin google google-plus pinterest medium vimeo stackoverflow reddit quora quora