any hint on how to create a keyboard shortcut to translate a selected text in Safari (or, even better, in any app?)
-
Needs a proper answer, but I use Popclip with Translatium. Not keyboard shortcut, but select text and click on the pop up button– GilbyCommented Sep 8, 2022 at 7:03
-
1When I select text in Safari (and other apps) and right-click with the mouse a menu pops up and offers to translate the selected text for me ... and you can use the accessibility feature 'Enable Mouse Keys' to, well, use the keyboard to control the mouse (Ctrl+5-on-the-digit-keypad implements a right-click). Have I entirely missed the point of the question?– High Performance MarkCommented Sep 8, 2022 at 8:41
-
Gilby's solution - although requiring a paid app -seems really interesting, as I can work mouse-less. I've liked also that on Translatium I can save my searches to recall later. I'll try to work out something with an Automation service. Thanks for your inputs!– Mart RCommented Sep 8, 2022 at 11:56
4 Answers
Yes this is possible with the Shortcuts app. It will work in Safari or any app that lets you select text. You can bind it to any keyboard shortcut. You can even use it on iPhones and iPads.
You can try the one I use here
It's very easy to set one up and customize it, say if you want to change the translation language:
On Ventura (and certainly several preceding OS versions), I have an option to Translate text in the contextual menu of any text I right-click on:
I'm fairly sure it's not a third-party add-on -- if it were, it would be lower down the menu, surely.
I found a Safari extension that translates selected text.
This extension is made by uetchy and is named Polyglot. You can find instructions on GitHub or simply download Polyglot from App Store.
Setup:
- Install Polyglot.app from the Mac App Store
- Open the Polyglot.app in Applications
- Configure Settings in Polyglot.app
- Open Safari > Settings > Extensions
- Activate Polyglot Extension
- Extension is now available Note: any pages that were already open before the extension was activated may need to be reloaded for the extension to work on them.
Here is what I did for the most simple possible shortcut. Let's you highlight some text anywhere in macOS, run this Shortcut (I do it from the Services menu or add a keyboard shortcut to it), and it will open a pop-up Safari window with your text in Google Translate.
- Receive [Text] input from [Quick Actions]
- URL [Encode] [Shortcut Input]
- https://translate.google.com/?sl=auto&tl=en&text=**URL Encoded Text**
- Show webpage at URL
Make sure in step 3, the URL Encoded Text variable is part of the URL, i.e. let no space exist between them. Add the [URL ENCODED TEXT] variable right into the URL itself, not as an additional variable via the "+" sign.
And make sure "Services" is checked under the "Quick Actions" sidebar preferences.