Fast translation with Google Translator and MAC OSX

Luke Dorosz
2 min readOct 21, 2015

--

For most of you and me, Google Translator is a very useful tool in daily work life. But Copy text or word and Paste into browser with opened Google Translator consume a lot of time.

Google Translator and Mac OSX

Fortunately there is solution I found somewhere in the Internet to improve this tool and safe a lot of time. Using Automator you can integrate a Goole Translator with MAC OSX in few steps:

  • Open an Automator and create a new Service.
  • The top section set in this way:
  • From the left column you need to find and grab two functions: Run Apple Script and Website Popup.
  • Copy and Paste this code into Apple Script window.
on run {input, parameters}
set output to "http://translate.google.com/translate_t?sl=auto&tl=pl&text=" & urldecode(input as string)
return output
end runon urldecode(x)
set cmd to "'require \"cgi\"; puts CGI.escape(STDIN.read.chomp)'"
do shell script "echo " & quoted form of x & " | ruby -e " & cmd
end urldecode

[UPDATE.12.2018- I paste the code that I used on the lastest Mac OS]

In the second line the url is configured with the parameter sl=auto, so it means that language of a translated word will be automatically detected. Of course you can set manually this value for the preferred language code.

  • As last step you can customise a Website Popup window size, position and browser.

Save and use

After save, a configured script is ready to use.

One way to work with a tool is to highlight a word and by right click go to Services and select a saved script:

As a result you will see this window:

Second method which I prefer is to create keyboard shortcut and use it with highlighted words.

To create a keyboard shortcut go to System Preferences -> Keyboard and Shortcuts tab. Next on the left, select Services and when you will find your created service, configure your own shortcut.

--

--

Luke Dorosz
Luke Dorosz

Written by Luke Dorosz

New tech geek, traveler, 🏃‍♂️ and 🏌️‍♂️Independent Cloud Consultant&Architect. Leader of AWSUG PL. AWS Community Hero

Responses (17)