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.2.tar.gz
(59.6 kB
view hashes)
Built Distribution
Close
Hashes for translate_shell-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65b6082b512a96d6bbd4ffdf706ebd513f39bfd0a250139179f80c3e6481c65a |
|
MD5 | c73ba68204cf94b1e75ff4593b798835 |
|
BLAKE2b-256 | 1872471a12f02e44bc80f8e4f8eab79c7ac9bae50eebdfa7ad09d99bb31bddc0 |