This application provides real-time translation capabilities, including text input translation, screen capture OCR translation, and a graphical user interface for easy control.
- Real-time text translation as you type
- Screen capture and OCR translation
- Support for multiple languages
- User-friendly GUI for easy control and language selection
- Hotkey support for quick toggling and screen capture
- Python 3.7+
- PyQt6
- deep_translator
- pyautogui
- pyperclip
- gTTS
- playsound
- Pillow
- pynput
- requests
- python-dotenv
-
Clone this repository:
git clone https://github.com/b9llach/inline-translator.git cd inline-translator -
Install the required packages:
pip install -r requirements.txt -
Create a
.envfile in the project root and add your OCR Space API key:KEY=your_ocr_space_api_key_here
-
Run the main script:
python main.py -
Use the GUI to select your target language and control translation settings.
-
Type anywhere on your system to see real-time translations.
-
Use F9 to toggle translation on/off.
-
Use F10 to capture a screen area for OCR translation.
main.py: Entry point of the applicationtranslator.py: Core translation logicgui.py: Graphical user interfacescreen_capture.py: Screen capture functionalitykeyboard_input.py: Keyboard input handling
You can create a standalone executable of this application using PyInstaller. This allows you to run the application without needing Python installed on the target machine.
-
Install PyInstaller:
pip install pyinstaller -
Navigate to the project directory:
cd path/to/inline-translator -
Create the executable:
pyinstaller --onefile --windowed --add-data ".env:." --name inlinetranslator main.py -
The executable will be created in the
distfolder within your project directory.
Note: Make sure all required files (like the .env file) are in the same directory as the executable when distributing it.
