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 details)
Built Distribution
File details
Details for the file translate-shell-0.0.2.tar.gz
.
File metadata
- Download URL: translate-shell-0.0.2.tar.gz
- Upload date:
- Size: 59.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 360dec167adeb56505cefd119bd07aa131f4342e30a8901d1577626676955e8e |
|
MD5 | 297f8dcb6e768f06827c5dc7a1694751 |
|
BLAKE2b-256 | 6b362acb369f21774afd448a306fb2f832b2db35eaf07fc98da1dad550a8aab7 |
File details
Details for the file translate_shell-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: translate_shell-0.0.2-py3-none-any.whl
- Upload date:
- Size: 56.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65b6082b512a96d6bbd4ffdf706ebd513f39bfd0a250139179f80c3e6481c65a |
|
MD5 | c73ba68204cf94b1e75ff4593b798835 |
|
BLAKE2b-256 | 1872471a12f02e44bc80f8e4f8eab79c7ac9bae50eebdfa7ad09d99bb31bddc0 |