AN
anacesh/Hotkey-translator-gemini
Application for instant text translation and enhancement via Gemini API with hotkey support
Text Translator & Enhancer
✨ Application for instant text translation and enhancement via Gemini API with hotkey support
Key Features
- One-click translation of selected text
- Translation enhancement using Gemini AI
- Flexible configuration via config file
Usage Examples
- Select the text you want to translate.
- Press
ctrl+shift+t(or your configured hotkey). - The translated and enhanced text will be automatically pasted in place of the original.
Installation
Clone the repository:
git clone https://github.com/anacesh/Hotkey-translator-gemini
cd text-translatorInstall dependencies:
pip install -r requirements.txtObtaining a Gemini API Key
- Go to Google AI Studio.
- Click "Get API key" in the menu.
- Create a new API key.
Copy the key to config.json:
"gemini_api_key": "YOUR_GEMINI_KEY"❗ Important: The Gemini API is not available in all countries. Check the list of supported regions.
Configuration
The config.json file contains the main settings:
{
"hotkey": "ctrl+shift+t",
"enable_alt_copy": true,
"default_target_language": "en",
"use_gemini": true,
"send_original_to_gemini": true,
"system_prompt": "...",
"gemini_extra_prompt": "...",
"languages": {
"ru": { "target": "en" },
"en": { "target": "ru" }
}
}Main Parameters:
hotkey: Hotkey for activation (e.g.,ctrl+shift+t).use_gemini: Enable translation enhancement via Gemini API (trueorfalse).system_prompt: System prompt for the Gemini model.languages: Translation language settings (e.g.,{"ru": {"target": "en"}}).
️ Run
python main.py️ Project Structure
text-translator/
├── clipboard_handler.py # Clipboard handling
├── config.py # Configuration manager
├── main.py # Entry point
├── translator.py # Translation and Gemini API logic
├── tray_icon.py # System tray icon
├── config.json # Configuration file
└── requirements.txt # Dependencies
Ограничения
- Administrative privileges are required for keyboard event handling.
- The Gemini API may have request limitations.
- X11/Wayland is required for Linux operation.
📄 License
MIT License © 2025 [anacesh]