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 "https://translate.google.com/#auto/" & 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

img-alternative-text

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! 🖖

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s