Google Translate on Force.com

This week I'm joining my colleagues and folks from Google and Amazon at the Cloud Connect event here in Mountain View.  We are discussing how these great clouds can be used together to build truly useful solutions for the enterprise.  While prepping for the chalk talks, I was looking for some code that I wanted to show off.  I looked first in this Blog, then in the developer wiki, still no luck so I jumped over to the Code Share project directory and drilled into the Google Data Toolkit project and found it.
What I was looking for, and found, was the code to translate the contents of a text field into another language, I included this into the Google Data toolkit a few months ago and forgot to mention that fact this in this Blog.  So, I'd like to introduce this idea in-case you are interested in solving this type of problem in your application.

Basically we are using Apex Code and HTTP Send() to take the contents of a text field and send it off to Google Translate

API.  The Google Translate API will return a JSON object, which we can capture and parse using Apex Code (the server side).  We then draw the resulting information inside a detail page, using an inline Visualforce page.
  
Here is an image of the screen showing how this looks in my example.   Who knows what other JSON API's you can find that will be easy to integrate into a Force.com app.  Be sure to check out the JSON parser project also.

If this looks interesting and you would like to try it out, please head over the the Code Share directory and check out the Google Data Project, look for the TranslateService.cls.

Published
January 21, 2009
Topics:

Leave your comments...

Google Translate on Force.com