Highlight, translate, show! You always need to translate a text on the fly, this script lets you translate the highlighted text and shows a notification with the original/translated text.
Note: The official Google Translate API is not available for free, so this script is using translate.googleapis.com API that is internally used by the Google Translate extension for Chrome and requires no authentication.
Just run sudo apt-get install xsel curl sed mawk
- xsel manipulate the X selection.
- curl a command line tool and library for transferring data with URLs.
- sed a stream editor.
- awk a domain-specific language designed for text processing and typically used as a data extraction.
- open terminal
cd <path/to/repo>
./install
Note: don't run as sudo, but there is an internal command that require sudo, so you will be asked for it
Now you will find that there is a keyboard shortcut has been created "Super + t".
- Highlight any word on the screen on any window.
- Click "Super + t".
- A notification pop-up with the translation will appear