translater
Version, currently 0.7.227 versions
- 0.7.2latestSep 19, 2026
- 0.7.0Jul 13, 2024
- 0.6.6not indexedDec 6, 2024
- 0.6.5not indexedDec 6, 2024
- 0.6.4not indexedDec 6, 2024
- 0.6.3not indexedDec 6, 2024
- 0.6.2not indexedDec 6, 2024
- 0.6.1not indexedDec 6, 2024
- 0.6.0not indexedDec 6, 2024
- 0.5.0not indexedDec 6, 2024
- 0.4.9not indexedDec 6, 2024
- 0.4.8not indexedDec 6, 2024
- 0.4.6not indexedDec 6, 2024
- 0.4.4not indexedDec 6, 2024
- 0.4.3not indexedDec 6, 2024
- 0.4.2not indexedDec 6, 2024
- 0.4.1not indexedDec 6, 2024
- 0.4.0not indexedDec 6, 2024
- 0.3.0not indexedDec 6, 2024
- 0.2.3not indexedDec 6, 2024
- 0.2.2not indexedDec 6, 2024
- 0.2.1not indexedDec 6, 2024
- 0.2.0not indexedDec 6, 2024
- 0.1.1not indexedDec 6, 2024
- 0.1.0not indexedDec 6, 2024
- test1not indexedDec 6, 2024
- t0.3.0not indexedDec 6, 2024
github.com/crystal-china/translater
command line translate tools, Use headless firefox internally, support Linux/Mac for now.
Installation
# Add this to your shard.yml
dependencies:
translater:
github: crystal-china/translater
version: ~> 0.7.2Then run:
shards installshard.yml
- Crystal
1.11.2- License
- MIT
- Author
- Billy.Zheng
- Target
translaterfrom src/cli.cr
Dependencies
Runtime Dependencies
Development Dependencies
- ameba*github: crystal-ameba/amebadev
README
translater
基于多翻译引擎的整句翻译命令行程序,仅支持 中英、英中 整句互译,会根据要翻译的语言自动判断。
当前代码包含以下翻译引擎:
以上状态来自实际的 headless Firefox 测试,但网页结构和反自动化策略会随时变化,因此不保证引擎始终可用。首次安装或发现引擎失效时,请运行 translater --init 检测引擎;检测结果会保存在 XDG 数据目录中,默认选择引擎时会排除检测失败的引擎。之后也可以随时重新检测。
本工具适合中英文整句互译,如需翻译单词详细释义,请使用其他工具。
默认会随机选择一个支持的引擎来翻译,这可以避免过于频繁的使用某一翻译引擎而导致 IP 被封。
搭配 goldendict 作为词典之一,一起食用效果更佳!

╰─ $ bin/translater 'hello world!'
Using Ali
---------- Ali, spent 7.15 seconds use Firefox ----------
你好世界!
╰─ $ bin/translater '那些杀不死你的,终将使你变得更强大'
Using Bing
---------- Bing, spent 6.07 seconds use Firefox ----------
What doesn't kill you will make you stronger
某一翻译引擎运行一次之后,如果再次选择该引擎,因为使用了浏览器 cache, 速度将得到极大提升!
在我本地测试,平均出翻译结果时间在两秒左右。
╰─ $ bin/translater -e ali "Those who can't kill you will eventually make you stronger."
Using Ali
---------- Ali, spent 1.91 seconds use Firefox cache ----------
那些不能杀死你的人最终会让你更强大
╰─ $ bin/translater -e bing '你好,世界!'
Using Bing
---------- Bing, spent 2.90 seconds use Firefox cache ----------
Hello, world!
translater --help 获取有关参数的更多帮助。
Arch Linux 安装
可以通过 Arch Linux 的 AUR 仓库安装 translater-git 或自建源
yay -Syu translater
Dependencies
火狐(Firefox)浏览器及 geckodriver (selenium driver for Firefox).
以 Arch Linux 为例:
$: pacman -S firefox geckodriver
或安装 Firefox 之后,自己下载 geckodriver,并拷贝至 /usr/local/bin
Sqlite3
translater 使用 Sqlite3 保存缓存的 session,来加速翻译流程。
translster 同时还维护一个最快引擎的数据库,会自动记录每次不同引擎翻译的耗时, 可以使用 --profile 初始化数据库以及分析那个翻译引擎速度快一些。,见:--auto 以及 --profile 选项。
Installation
从 release 页面 下载(单文件)最新版, 扔到 $PATH 的文件夹里,目前支持 Linux 和 OSX.
或者从源码编译安装:
$: make release
$: sudo make install
已知限制
- 翻译依赖第三方网页 DOM,不是官方 API;站点改版后可能需要更新 selector。
Contributing
- Fork it (https://github.com/zw963/translater/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Billy.Zheng - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.7.2- Tagged
- Sep 19, 2026
- Commit
71018dc4790b- Crystal
1.11.2- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/crystal-china/translater
Metadata
- Created
- Aug 12, 2026
- Updated
- Nov 21, 2026
- Synced
- Nov 21, 2026
- Versions
- 27