Fast translation with Google Translator and MAC OSX

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.
on run {input, parameters}
  set output to "http://translate.google.com/translate_t?sl=auto&tl=pl&text=" & urldecode(input as string)
  return outputend runon urldecode(x)
  set cmd to "'require "cgi"; puts CGI.escape(STDIN.read.chomp)'"
  do shell script "echo " & quoted form of x & " | ruby -e " & cmdend 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:

Image for post

Image for post

As a result you will see this window:

Image for post

Image for post

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.