Google Translator Service

MacOS has very handy shortcut ⌃⌘D to look up translations in the built-in dictionary. Unfortunately this does not always help if the word in question is either not in English or the definition is equally puzzling.

Automator to the rescue

Combining sources like this question in apple.stackexchange and this blog post in blog.fosketts I created an Automator Service that takes selected text from any application and then opens Google Translate with Auto->ET translation of the selection. Also added a shortcut for it: ⌃⇧⌘D

The AppleScript

Open Automator and create a New > Service, then search for Run AppleScript and drop that into the workflow. Then paste in this AppleScript from below.

on run {input, parameters}
	set phrase to input as string
	set myBrowser to "Google Chrome"
	set toLang to "et"

	tell application myBrowser
		open location "" & toLang & "/" & phrase
	end tell
end run

Change myBrowser to your preferred browser and also toLang to desired destination language and then save the service. I chose name Translate to Estonian for obvious reasons.

The global shortcut


Next open System Preferences > Keyboard > Shortcuts and scroll down to your new service. Then add a convinient shortcut. I chose ⌃⇧⌘D because that is similar to the official Look up shortcut.

Now go forth and translate! 🖖