Skip to main content

PyElant

Python Easy Language Translator

PyPI Python versions CI

PyElant is a small command line tool that translates text with Google Translate and puts the result on your clipboard. It can take input from the command line, from the clipboard or from your microphone.

Leave it running in the background and use a hotkey to translate whatever you just copied, or what you just said. Then paste the translation into your editor, browser or chat without switching windows.

Installation

PyElant requires Python 3.10 or newer.

pip install pyelant

To also use microphone input, install the mic extra:

pip install "pyelant[mic]"

pipx or uv also work well for command line tools like this one: pipx install pyelant or uv tool install pyelant.

System requirements

  • Linux: clipboard access needs xclip or xsel (X11) or wl-clipboard (Wayland). Global hotkeys only work under X11 (including XWayland apps), not native Wayland apps. Microphone input needs the PortAudio headers if no PyAudio wheel exists for your platform:

    sudo apt install xclip              # clipboard
    sudo apt install portaudio19-dev    # only for microphone input
    
  • macOS: to use the hotkeys, give your terminal app permission under System Settings → Privacy & Security → Accessibility (and Input Monitoring). Microphone input also needs microphone permission. Desktop notifications may not appear when PyElant runs from a plain terminal. Translations still work as normal.

  • Windows: no extra setup needed.

Usage

There are three ways to use PyElant:

  1. Command line: translate a piece of text right away.
  2. Clipboard: press a hotkey to translate what you copied.
  3. Microphone: press a hotkey and speak.

Command line

Pass the text with -t / --text. PyElant prints the translation and copies it to your clipboard:

pyelant -t "This sentence will be translated to Japanese."

Clipboard

Start PyElant with no text and leave it running in the background:

pyelant

Copy some text, then press Ctrl+Alt+E. The translation replaces the clipboard contents, ready to paste.

Microphone

With PyElant running in the background (see above), press Ctrl+Alt+M, say something and wait. When the translation is done it is copied to your clipboard. This mode needs the mic extra.

Press Ctrl+C in the terminal to stop PyElant.

Choosing languages

By default PyElant translates from English (en) to Japanese (ja). Use -i / --input_language and -o / --output_language to change this. Languages can be given as a code (pt, ko, zh-cn) or a name (portuguese, korean). Use -i auto to detect the input language automatically (for text only, not for microphone input).

pyelant -i pt -o en    # run in the background, translating Portuguese to English
pyelant -i fr -o ko    # run in the background, translating French to Korean
pyelant -i en -o it -t "This sentence will be translated from English to Italian."

Each run uses a single pair of languages. To switch languages, stop PyElant and start it again.

All options

Option Description
-i, --input_language Language to translate from. Default: en.
-o, --output_language Language to translate to. Default: ja.
-t, --text Text to translate. Without it, PyElant runs in the background.
-dn, --disable_notification Do not show a desktop notification with the translation.
-v, --verbose Print extra information.
--version Show the version and exit.

python -m pyelant works as well as the pyelant command.

How it works

Translations use Google Translate through googletrans, and speech is recognized with SpeechRecognition. Both use free, unofficial Google endpoints, so an internet connection is required and heavy use may be rate limited.

Development

git clone https://github.com/paulomarcos/pyelant
cd pyelant
uv run --all-extras pytest    # run the tests (offline)
uv run pytest -m network      # run the live tests against Google Translate
uv run ruff check             # lint
uv build                      # build the sdist and wheel

License

MIT License. See LICENSE.txt.

Metadata

Release files for pyelant 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyelant 0.2.0
File Size Uploaded Provenance Actions
pyelant-0.2.0.tar.gz 10.6 kB Without provenance Details for pyelant-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyelant 0.2.0
File Interpreter ABI Platform Actions
pyelant-0.2.0-py3-none-any.whl Python 3 none any Details for pyelant-0.2.0-py3-none-any.whl

Total release size: 18.3 kB

Release files / pyelant-0.2.0.tar.gz

Download URL pyelant-0.2.0.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
bc706efca1189726050fe89cac8823742908e3b65a59dfa535d681ef361233d9
BLAKE2b-256 checksum
How to use checksums
c08c83573a9dbbc4bfc200cabe6277e2dafbd52bc306de756d1e77a45808ab05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pyelant-0.2.0-py3-none-any.whl

Download URL pyelant-0.2.0-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9f32b9daacdd38bdafab4651692ce524a0ed7a8e1059d3432a811bf2f4f2610e
BLAKE2b-256 checksum
How to use checksums
313f8dab6ff7895b144344cb5877ba910f7ec16bf138a58644f4e79c091f9c2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for pyelant 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page