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 details)
Built Distribution
File details
Details for the file translate-shell-0.0.1.tar.gz
.
File metadata
- Download URL: translate-shell-0.0.1.tar.gz
- Upload date:
- Size: 58.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c655f212150c4ae6df45cff23184781ec33ac3cc6799e375c2fa44c9d2ac7439 |
|
MD5 | f94b3b4b1d6e54e433d10896d03e4200 |
|
BLAKE2b-256 | 8919c58e32a19590ca1792907733677c6772d6ad60eea3587ebd57225c5af2aa |
File details
Details for the file translate_shell-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: translate_shell-0.0.1-py3-none-any.whl
- Upload date:
- Size: 53.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d079fcc02aea5d1efd38062af8566a805718f237fc52711255c10bd256719b4 |
|
MD5 | 9da041ee66ff7eb236a639f3ac40b0f0 |
|
BLAKE2b-256 | 1824658d40d29dc08bfc5736759614074bed5d40afd88da60ed885c913455ea1 |