A fast popup translator for X11. Select text in any application, press a global shortcut, and get the translation next to the pointer.
Google Translate remains the zero-configuration default. If its unofficial endpoint rate-limits you, ew-translator can use Google Gemini, OpenRouter, OpenAI, or any server that implements the OpenAI Chat Completions API.
Provider selection is explicit: ew-translator does not automatically fall back to another source after an error. For example, an OpenRouter model ID such as google/gemini-2.5-flash-lite still uses OpenRouter; the google/ prefix identifies the model provider and does not select Google Translate.
xsel must be available in PATH.
GitHub releases provide an UPX-compressed Linux x86_64 binary and its SHA-256 checksum. Download both files into the same directory, then verify and install them:
sha256sum --check ew-translator.sha256
install -m 755 ew-translator ~/.local/bin/ew-translatorThe default target language is Russian and the default shortcut is Ctrl+Shift+F7:
ew-translatorChange them with options or environment variables:
ew-translator --lang fr --hotkeys 'CTRL+SHIFT+F8'
EW_TRANSLATOR_LANG=fr \
EW_TRANSLATOR_HOTKEYS='CTRL+SHIFT+F8' \
ew-translatorNo credentials are needed:
EW_TRANSLATOR_SOURCE=google-translate ew-translatorThis source uses an undocumented Google Translate endpoint and can return HTTP 429. Use one of the authenticated providers below when that happens.
EW_TRANSLATOR_SOURCE=gemini \
EW_TRANSLATOR_API_KEY='<gemini-api-key>' \
ew-translatorThe default Gemini model is gemini-2.5-flash-lite. Override it when needed:
EW_TRANSLATOR_SOURCE=gemini \
EW_TRANSLATOR_API_KEY='<gemini-api-key>' \
EW_TRANSLATOR_MODEL='<gemini-model-id>' \
ew-translatorOpenRouter requires an explicit model ID:
EW_TRANSLATOR_SOURCE=openrouter \
EW_TRANSLATOR_API_KEY='<openrouter-api-key>' \
EW_TRANSLATOR_MODEL='<provider/model>' \
ew-translatorEW_TRANSLATOR_SOURCE=openai \
EW_TRANSLATOR_API_KEY='<openai-api-key>' \
EW_TRANSLATOR_MODEL='<model-id>' \
ew-translatorSet the base URL ending at the API version. ew-translator appends /chat/completions unless it is already present:
EW_TRANSLATOR_SOURCE=openai \
EW_TRANSLATOR_API_KEY='<api-key-or-dummy-value>' \
EW_TRANSLATOR_MODEL='<server-model-id>' \
EW_TRANSLATOR_API_URL='http://127.0.0.1:1234/v1' \
ew-translatorPlain HTTP is accepted for local servers. Use HTTPS for remote services.
| Variable | Meaning |
|---|---|
EW_TRANSLATOR_SOURCE |
google-translate, gemini, openrouter, or openai |
EW_TRANSLATOR_API_KEY |
API key for an authenticated provider |
EW_TRANSLATOR_MODEL |
Model ID; required for OpenRouter and OpenAI-compatible sources |
EW_TRANSLATOR_API_URL |
Provider base URL |
EW_TRANSLATOR_LANG |
Target language code or name |
EW_TRANSLATOR_HOTKEYS |
Global shortcut |
EW_TRANSLATOR_CONFIG |
Path to an optional TOML config |
The API key deliberately has no command-line option, keeping it out of shell history and process listings.
No config is required or generated. If present, the default path is:
$XDG_CONFIG_HOME/ew-translator/config.toml; or~/.config/ew-translator/config.tomlwhenXDG_CONFIG_HOMEis unset.
Use another file with --config <path> or EW_TRANSLATOR_CONFIG=<path>. An explicitly selected missing or invalid file is an error.
source = "openrouter"
api_key = "<openrouter-api-key>"
model = "<provider/model>"
api_url = "https://openrouter.ai/api/v1"
lang = "ru"
hotkeys = "CTRL+SHIFT+F7"If the config contains api_key, protect it with chmod 600. Environment variables are preferable for secrets.
Settings are resolved in this order:
- command-line options;
- environment variables;
- optional TOML config;
- built-in defaults.
Run ew-translator --help for the complete and current list. Available options include --source, --model, --api-url, --config, --lang, and --hotkeys.
