Translate text by many different translators.
Project description
translate-shell
Usage
CLI
REPL
TUI
Vim
:Translate --translators=google,bing Free as in Freedom
bing
web. 自由;自由软件运动;中享受自由
google 自由自在
Script
Python
>>> from translate_shell.translate import translate
>>> translate("The Mythical Man-Month", "zh_TW")
... Translation(
... status=1,
... results=[
... {
... "translator": "google",
... "sl": "auto",
... "tl": "zh_TW",
... "text": "The Mythical Man-Month",
... "phonetic": "",
... "paraphrase": "人月神話",
... "explains": {},
... "details": {},
... "alternative": ["神话般的人月"],
... }
... ],
... text="The Mythical Man-Month",
... to_lang="zh_TW",
... from_lang="auto",
... )
Shell Script
$ xsel -o | trans --format json | jq -r '"《\(.results[].paraphrase)》的英文是 \(.text)."'
《大教堂和集市》的英文是 the cathedral and the bazaar.
Features
- Translate with different translators at same time, like translator
- Translate clipboard contents automatically, like ydcv
- Speak the pronunciation of words
- Support online translate engines
- Support offline dictionaries
- Many methods to use, from shell, python and vim
- Magic text, like
en:
to change source language,:zh_CN
to change target language,<file
to translate file, etc. - Allow customization by
config.py
- Good shell completions, especially for zsh, complete options and translation history
- Manpage:
man trans
- Beautiful UI
- Cross platforms
- Rich API, can be easily called from shell and python
- Good document
- Unit test, keep code quality
- CI/CD
- clean code
- Respect PEP484
- Respect PEP621
- Respect XDG
The last but not least: it is a libre software.
See document to know more.
PS: PR is welcome! Please make code clean and keep test pass!
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
translate-shell-0.0.1.tar.gz
(58.8 kB
view hashes)
Built Distribution
Close
Hashes for translate_shell-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d079fcc02aea5d1efd38062af8566a805718f237fc52711255c10bd256719b4 |
|
MD5 | 9da041ee66ff7eb236a639f3ac40b0f0 |
|
BLAKE2b-256 | 1824658d40d29dc08bfc5736759614074bed5d40afd88da60ed885c913455ea1 |