This small script can translate any text you select. After highlighting the text, be it in a web browser, Libreoffice or PDF document and so on, upon using a keyboard shortcut, its translation is displayed in a desktop notification.
Here are the dependencies for Debian/Ubuntu:
sudo apt-get install libnotify-bin wget xsel zenity xclip
Create a file for the script and make it executable:
sudo touch /usr/local/bin/notitrans
sudo chmod +x /usr/local/bin/notitrans
Choose your script from one of the three listed in the article and copy and paste it into the file ”/usr/local/bin/notitrans”.
Then, set a keyboard shortcut and you are done.
The first script only displays the text in notifications. The second script listed uses zenity to display the notification and gives you the option to copy the text to your clipboard. The third script listed displays the translation as a notification and automatically copies the text to your clipboard using xclip.















