On Translations

July 19, 2011 § Leave a comment

Languages have never really been a strong point of mine.  I took Spanish through high school and probably retain enough to order some beers and find the bath room in an emergency.  It comes down to the fact that I am not a huge fan of memorization.  Luckily there are amazing some tools out there to help.

Google Translate

The first one is probably one of the most used translation engines out there, Google Translate.  Sadly as many have probably already read a while ago, Google isn’t going to be offering it as a free service anymore citing extensive abuse. Luckily for those with real needs, there will be a paid version.  [link]

Since I spend a lot of my day on a command line I figured that it would be nice to have a little translate tool at my disposal.  One where I didn’t have to keep opening up a web page.  So I wrote a little bash function call the Google Translate’s API from the command line and print the results right there.

translate() {
  wget -qO- "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=$1&langpair=${3:-}|${2:-en}" | sed -E -n 's/[[:alnum:]": {}]+"translatedText":"([^"]+)".*/\1/p';
echo ''
  return 0;
}

You just drop this little guy in your .bashrc file and… Boom! Translations on the command line.

USAGE

translate  [] [<source language="" />]

The destination language is assumed to be English unless otherwise specified, and the source language is auto-detected if not specified.

$ translate hola
hello
$ translate hello es
hola
$ translate hello fr
bonjour
$ translate hola de es
Hallo
$ translate hola de
Hallo

I’m keeping my fingers crossed that Google keeps some sort of free version of the service available.  Check out the source in a more readable format over on github.

Word Lens

One of the other tools that had my jaw on the floor the first time I saw it was the iPhone app Word Lens.  Go over to the site and watch the demo video.  I’ll wait.  I love this thing.  It is an Augmented Reality (AR) app that uses the camera to read text and automatically replace it in image… in realtime.  Absolutely ridiculous.  It was very interesting to read a lot of the comments about the app when it first came out.  People we complaining about the language packs be $5 then the price getting upped to $10.  They were whining that it was too slow.  The couldn’t believe that it only did word by word translation and didn’t work on phrases.

Seriously?  Your telling me that being able point the camera in your phone at any sign in a foreign country (well, any Spanish speaking foreign country at the anyways) and immediately have it become understandable isn’t worth $10?  That you’d rather spend more on a phrase book and have to thumb through it by hand?  It is a proof of concept and a very good one at that.  Even in it’s current form it has the ability to change travel forever.  At the moment any English speaker has the ability to at least get the main point of any printed sign in Spanish, instantaneously.

Game changer.  It’s like your iPhone becomes a universal translator from Star Trek, or your mind is tweaked by the TARDIS and suddenly everything is comprehendible.

The Future is Now.

Where Am I?

You are currently browsing the iPhone category at The On Blog.