Apple’s Automator is a great to for scripting those activities that you find yourself doing over an over. I needed a way to translate a selection of text. I created this simple Automator workflow to grab the selected text and send it to Google’s Translation service. This flow is for English but you can edit the script to change the target language to anything you want.
Here are the steps in the workflow if you want to roll your own.
- Run AppleScript
on run {input, parameters} copy "http://translate.google.com/translate_t?sl=auto&tl=en&text=" & input to urlx return urlx end run
- Display Webpages
That’s the entire script. Enjoy.
Installation: Download TranslateThis.zip. Double-click on the zip file to open it up. Copy the “Translate This” workflow file to your ~/Library/Services folder. The ~/ is your home folder. You can get there from your “Go” menu.
It would be nice if the script could grab the page, find the translated DIV and then just display an alert with the translated text. That would save having to open a new Safari connection. This is just a first pass to make it useful.