Skip to content

A simple tool that leverages the OpenAI API to translate stuff on the screen when a shortcut is being pressed

License

Notifications You must be signed in to change notification settings

Fusseldieb/traytranslate

Repository files navigation

TrayTranslate

A simple tool that leverages the OpenAI API to translate text on the screen when a shortcut is pressed.

The shortcut in this case is hardcoded as Shift + Ctrl + PrtScr. The prompt, however, is customizeable and is in prompt.md.

Setting everything up

If you just want to run it, jump to section Running.

To use this app, first install Python 3.11. Then, populate the .env file with your OpenAI API key. Refer to .env.example for a reference.

After that, enable the virtual environment and set everything up:

Windows (PowerShell)

py -3.11 -m venv .venv   # Create the environment if you haven't already  
.venv\Scripts\Activate.ps1   # Activate it
pip install -r .\requirements.txt # Install all requirements

You can then either run the app directly:

python .\tray_translate_picker.py

Or build it into a standalone .exe with:

pyinstaller --onefile --noconsole tray_translate_picker.py
# Or to include a custom prompt
pyinstaller --onefile --noconsole --add-data "prompt.md;." tray_translate_picker.py

Running

If you download the prebuilt release and/or run the standalone executable, make sure to have the .env in the same directory. If you use the prebuilt release, note that prompt.md gets ignored, and a fallback "Image-to-English" prompt will be used, unless the prompt is explicitly bundled/included with pyinstaller.

About

A simple tool that leverages the OpenAI API to translate stuff on the screen when a shortcut is being pressed

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages