A command-line tool that integrates Youdao Dict and Google Translate.
Project description
Dict-tiny
A command-line tool that integrates Youdao Dict and Google Translate.
Just for fun :)
- Youdao Dict — bilingual dictionary with phonetic symbols, definitions, examples
- Google Translate — multi-language translation and language detection
- Interactive mode — continuous querying with tab auto-completion
- Word book — records and queries translation history
Installation
Requires Python >= 3.11.
$ pip install dict-tiny
To upgrade:
$ pip install --upgrade dict-tiny
Quick start
# Youdao Dict (default)
$ dict-tiny book
# Google Translate, auto-detect source
$ dict-tiny -g book
# Interactive mode with tab completion
$ dict-tiny -y -i
Usage
Options
$ dict-tiny
Usage:
dict-tiny [SWITCHES] [SUBCOMMAND [SWITCHES]] words...
GoogleTranslate:
--detect-language Detect the language of the given text
-g, --google Use Google Translate
Meta-switches:
-h, --help Prints this help message and quits
--help-all Prints help messages of all sub-commands and quits
-v, --version Prints the program's version and quits
Switches:
-c, --clipboard Use the contents of the clipboard.
-i, --interactive Interactive mode
--no-record Skip recording this query
--record Record query to word book
--sl, --source-language VALUE:str Source language (YoudaoDict only supports en/fr/ja/ko)
--tl, --target-language VALUE:str Target language (YoudaoDict only supports en/fr/ja/ko)
YoudaoDict:
-m, --more Get more details
-y, --youdao Use Youdao Dictionary to translate
Sub-commands:
wb see 'dict-tiny wb --help' for more info
Youdao Dict
Youdao is the default translator. It supports Chinese↔English, Chinese↔French, Chinese↔Japanese, and Chinese↔Korean. The default is Chinese↔English.
Language codes:
| Code | Language |
|---|---|
en |
English |
fr |
French |
ja |
Japanese |
ko |
Korean |
Chinese is the implicit counterpart — no need to specify zh. For example, Chinese↔Japanese requires --target-language ja or --source-language ja.
English query
$ dict-tiny book
>>> YoudaoDict <<<
book
======
[美]bʊk [英]bʊk
n. 书,书籍;本子,簿册;(长篇作品的)篇,卷,部;装订成册之物;赌局,打赌;账册,账簿
v. 预订,预约;(警方)将……记录在案;(裁判)记名警告
【名】 (Book)(英)布克,(瑞典)博克,(朝)北(人名)
复数: books, 第三人称单数: books, 现在分词: booking, 过去式: booked, 过去分词: booked
Chinese query
$ dict-tiny -y 书
>>> YoudaoDict <<<
书
===
shū
book
书,书籍;本子,簿册;(长篇作品的)篇,卷,部;装订成册之物;赌局,打赌;账册,账簿;预订,预约;(警方)将……记录在案;(裁判)记名警告;【名】 (Book)(英)布克,(瑞典)博克,(朝)北(人名);
write
写作,编写;写道;写信;书写,写字;谱写(音乐作品);编写(计算机程序);将(计算机中的)数据写入(磁盘或其他储存媒体);填写(表格、支票等),拟定;(笔)能写字;拼写;<加,南非>参加(笔试);书写,手写(与铅印相对);以写作为生;承保(保险单);
letter
信,信函;字母;<美>(缝制在运动服上的)校运动队首字母标志;<英,非正式>(代表学位或职位等资格的)首字母缩略词(letters);文学;法律文书,正式文书(letters);字面确切含义;(印刷)一种铅字字体;<古> 学识,渊博的学问;用字母标注;把字母印刷(或缝制等)于;<美>赢得学校运动队的字母标志;【名】 (Letter)(美、英、巴西)莱特(人名);
script
剧本,讲稿;笔迹,手写体;连写体,草体;字体;(一种语言的)字母系统,字母表;<英>(考生的)笔试答卷;脚本(程序)(计算机的一系列指令);<非正式>(医生的)处方;期待,计划;写剧本,写讲稿;事先准备,计划;
More detail with -m
$ dict-tiny -y dictionary -m
>>> YoudaoDict <<<
dictionary
============
[美]ˈdɪkʃəneri [英]ˈdɪkʃən(ə)ri
n. 字典,词典;专业词典,术语大全;电子词典;双语词典
复数: dictionaries
📖 collins:
dictionary【ˈdɪkʃənərɪ】
======== 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.
…一本西班牙语—英语词典。
Specify target / source language
# Translate to Japanese
$ dict-tiny -y 进击的巨人 --target-language ja
>>> YoudaoDict <<<
进击的巨人
=======
jinjidejuren
進撃の巨人(しんげきのきょじん)(日本漫画家谏山创创作的少年漫画作品,于2009年在讲谈社旗下的漫画杂志《别册少年》上开始连载。)
# French source
$ dict-tiny -y Bonjour --source-language fr
>>> YoudaoDict <<<
Bonjour
=========
bɔ̃ʒu:r
[m.]
早安,日安,白天好,你好
# Korean source
$ dict-tiny -y "go는 구글이 만든 오픈 소스 프로그래밍 언어이다" --sl ko
>>> YoudaoDict <<<
go는 구글이 만든 오픈 소스 프로그래밍 언어이다
=============================
go는 谷歌开发的开源程序设计语言
Google Translate
Add -g / --google to use Google Translate. Supports all ISO 639-1 languages.
--source-language specifies the source language of the input text. In most cases
this is optional, as the Google Translate API automatically detects the source
language. If you specify the wrong source language, the translation result may not
be what you expect.
The default target language is English. Use --target-language to change it, or
set DICT_TINY_TARGET_LAN environment variable (command-line flag overrides
environment variable).
$ dict-tiny -g book
>>> GoogleTranslate <<<
book
======
output: 书
detected language: en
Specify target / source language
$ dict-tiny -g operation system --target-language ja
>>> GoogleTranslate <<<
operation system
==================
output: オペレーションシステム
detected language: en
You can use ISO codes or full language names:
$ dict-tiny -g book --target-language zh --source-language en
>>> GoogleTranslate <<<
book
======
output: 书
source language: en
$ dict-tiny -g book --target-language German --source-language English
>>> GoogleTranslate <<<
book
======
output: Buch
source language: english
Detect language
$ dict-tiny -g --detect-language español
>>> GoogleTranslate <<<
español
=========
confidence: 0.49805447459220886
input: español
language: es
name: Spanish
Note: --detect-language must be used together with -g.
Interactive mode
Add -i to enter interactive mode. Press Ctrl + d to exit.
- Continuously query words in an interactive session
- Press Tab for word auto-completion (powered by Youdao, supports Chinese, English, French, Japanese, Korean)
- Settings (target/source language) are fixed once in interactive mode
$ dict-tiny -y -i
Clipboard
Use -c / --clipboard to translate clipboard content:
$ dict-tiny -c -y
Note: -c has lower priority than passing a word directly.
Multiple translators
Use -y and -g together to show results from both translators:
$ dict-tiny formulation -y -g
>>> YoudaoDict <<<
formulation
=============
[美]ˌfɔːrmjuˈleɪʃ(ə)n [英]ˌfɔːmjuˈleɪʃ(ə)n
n. (政策、计划等的)制定,构想;(想法的)阐述方式,表达方法;(药品或化妆品的)配方,配方产品
复数: formulations
--------------------
>>> GoogleTranslate <<<
formulation
=============
output: formulation
detected language: en
Word book
The word book records translation history. Recording is off by default.
Use --record to record a single query, or set it as default with:
$ dict-tiny wb config --record on
Commands
$ dict-tiny wb <command> [...]
Commands: list, detail, query, search, delete, config, db-delete
Each subcommand supports --help, e.g. dict-tiny wb list --help.
wb list — list entries
$ dict-tiny wb list --sort freq
ID Text Lang Created Count
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1 hello en→zh 2026-05-28 16:36 ×252
2 world en→zh 2026-05-28 16:37 ×100
3 apple en→ja 2026-05-28 16:40 ×53
4 resilience zh↔en 2026-06-01 16:15 ×1
5 guardrails zh↔en 2026-06-01 15:22 ×1
Page 1/1 (5 entries, limit 10000)
When the entry limit (10000) is reached, the least recently queried entry is evicted.
| Option | Description |
|---|---|
--sort SORT |
created, freq, or recent |
--since DATE |
Filter by start date (YYYY-MM-DD) |
--page N |
Page number (default: 1) |
--page-size N |
Entries per page (default: 20) |
Note:
-
The Lang column shows the effective languages — defaults are shown if not explicitly set (e.g. Youdao defaults to
zh↔en). Usewb detail <ID>to see the raw stored values. -
The stored translator, source language, and target language are updated to the values used in the most recent query for that entry.
wb detail — show entry details
$ dict-tiny wb detail 1
Text: hello
Source Language:
Target Language:
Translator: youdaodict
Created: 2026-06-01 10:30:00
Last Query: 2026-06-01 11:20:00
Access Count: 3
wb query — re-translate an entry
Re-translates the entry using its stored text and languages. Supports overriding
the translator or languages via top-level flags (e.g., -g, --target-language).
# Re-translate entry ID 1 with its stored translator
$ dict-tiny wb query 1
# Re-translate with Google Translate, target Japanese
$ dict-tiny -g --target-language ja wb query 1
wb search — search entries
Fuzzy search by default (LIKE '%text%'). Use --exact for exact match.
$ dict-tiny wb search hello
$ dict-tiny wb search hello --exact
| Option | Description |
|---|---|
--exact |
Exact match instead of fuzzy |
--sort SORT |
created, freq, or recent |
--since DATE |
Filter by start date (YYYY-MM-DD) |
--page N |
Page number (default: 1) |
--page-size N |
Entries per page (default: 20) |
wb delete — delete an entry
$ dict-tiny wb delete 1
Entry ID:1 deleted.
wb config — view or change settings
$ dict-tiny wb config
Entries: 5 / 10000
Default Recording: OFF
$ dict-tiny wb config --record on
Default recording: ON
Use --record on or --record off to enable or disable default recording.
wb db-delete — delete the database
Deletes the entire word book database file.
$ dict-tiny wb db-delete
Word book database deleted.
Notes
-
Input text is limited to 3000 characters. Both Youdao Dict and Google Translate will reject longer input.
-
Subcommands like
detail,query, anddeletetake the entry ID as shown in the first column ofwb listoutput. The ID is auto-incremented and may be non-contiguous; it does not reflect the current display order. -
Top-level flags (
-y,-g,--record,--no-record,--sl,--tl) must come beforewb:dict-tiny -y --no-record wb query 1 # ✓ dict-tiny wb query 1 -y --no-record # ✗
Environment variables
| Variable | Default | Description |
|---|---|---|
DICT_TINY_DEFAULT_TRANS |
youdaodict |
Default translator (youdaodict / googletranslate) |
DICT_TINY_TARGET_LAN |
Default target language | |
DICT_TINY_SOURCE_LAN |
Default source language |
Command-line flags override environment variables.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dict_tiny-2.1.0rc1.tar.gz.
File metadata
- Download URL: dict_tiny-2.1.0rc1.tar.gz
- Upload date:
- Size: 37.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d0e182c40d54078399732ab080f629986c69cbd6776d6b576e483d0c9c539b2
|
|
| MD5 |
a4dcabdeb62ff5794a05f8295fd31664
|
|
| BLAKE2b-256 |
b867d4485a97128e1221af48369b2c53bd727d5a00dc60fecb954ce1a6ca3f98
|
File details
Details for the file dict_tiny-2.1.0rc1-py3-none-any.whl.
File metadata
- Download URL: dict_tiny-2.1.0rc1-py3-none-any.whl
- Upload date:
- Size: 29.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
686d7cd13700976104ce222a77389ab79585fca5df401c95a111b951cbf91cc5
|
|
| MD5 |
dbdb0f9cadbbecc7cfe73bdabc235719
|
|
| BLAKE2b-256 |
d2b24f7a226b2a7fc0e1a3f99a51daff3b09f811be1c8406f6a55c6618351dc3
|