I recently stumbled upon an interesting tiny old script (which I’ve updated) which 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.