10,000 Monkeys - Harnessing the Power of Typing Monkeys

America's 2,672,401st Most Read Blog by Kevin Marshall.
in

Google AJAX Language API & Office Communicator Custom Translation Tabs

While waiting for Lost to start, I was catching up on some RSS feeds.  I just dropped TechCrunch & anything mentioning Scoble in my recent news feed pruning which has decreased my news volume nicely.  One noteworthy item today was the launch of Google's AJAX Language API.  I think it's the only translation web service out there.  One downside is that it's JavaScript only.  It would be nicer if there was a REST web service to call to make it easier to integrate into desktop apps or to bulk convert text in a service.

A cool use of it I think would be to integrate into existing IM clients.  I have a few French & Spanish speaking friends so it would be helpful if my IM client could auto-translate since my foreign language skills are at a kindergarten level. 

Lately I've been using Office Communicator since we have a new kick a$$ VOIP setup..(so nice to be able to transfer an IM conversation to a phone call and chat via my USB speaker phone.)  Anyway, I was looking for something to try out the Google translation API and I started looking at the communicator API.  I didn't realize you could just add a new tab of HTML via a quick registry setting.  In about 15 minutes I was able to create this:

image

It's probably not super useful, but it's always fun to try out new stuff. 

Adding a New Tab to Communicator

This TechNet article explains how to add a new tab in communicator.  Basically you just need to create a new registry string value under HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Communicator.

I set the value to "file:///C:/communicatorTab.xml"

In the XML file I put:

<?xml version="1.0" ?>
<tabdata>
   <tab>
     <image>file:///c:/communicatorTab.png</image>
      <accessibility>both</accessibility>
     <userid>false</userid>
     <name>the name to display on the tab</name>
     <tooltip>the tooltip to show</tooltip>
     <contenturl>http://localhost/communicatorTab.htm</contenturl>
     <contactid>false</contactid>
     <method>get</method>
     <tabid>1</tabid>
   </tab>
  </tabdata>

For the contentUrl, you need to point to an HTML file which will be displayed in the tab.  I wasn't able to get it working via "file:///c:/communicatorTab.htm", but according to the docs that should work.  I'm running IIS so I just put it on my web server.  If you are sharing this, you'd probably want to put it on a web server anyway.

Calling the Translation API

Here is a copy of the HTML file I used.  I made the UI simple so it didn't take up much space.  You just enter some text in one of the supported languages and select a language to translate to.  Clicking "Translate" replaces the text you entered with the translated text.  It doesn't support every language translation pair.  So you can't to Chinese to Arabic yet.  The supported pairs are here.  The nice thing about the API is that it auto detects the source text language so you don't have to select "Spanish to English"

Invoking the Google API is really simple.  Just call translate with the source, leave the source language blank to auto-detect, the target language code and the return function.

google.load("language", "1");

function translate() {
  var source = document.getElementById("source");
  var target = document.getElementById("target");
  google.language.translate(source.innerHTML, "", target.value, function(result) {
    if (!result.error) {
      var source = document.getElementById("source");
      source.innerHTML = result.translation;
    }
    else {
      alert(result.message);
    }
  });
}

 

Now you can pretend to be a cultured international business man/woman and easily throw a few foreign words into the conversation.  Tres Cool.

In the future I might try integrating the API into the Office Communicator Web client because I think I'd be able to do real-time translation of conversations pretty easily.  It's currently #11 on my side-project list.

 

Comments

microsoft iis said:

Pingback from  microsoft iis

# March 23, 2008 10:58 PM

Chris Mayo's Blog - What we have here... said:

I generally like any post that starts with "While waiting for Lost to start..." and ends up with something

# March 26, 2008 2:43 PM

bred said:

good work man <a href=" groups.google.us/.../pics-upskirt-me ">beyonce upskirt video</a>  jfpa

# May 20, 2008 8:44 PM

cheap kansas said:

gdsgdsf gdsfgdsfg sdgfgdsfg sdfgdsf g<a href=" groups.google.us/.../ticketsss ">carolina panthers tickets</a>

# May 23, 2008 5:17 PM

mona said:

good work man <a href=" groups.google.us/.../replica-watches-ex ">replica watches store

</a>  637

# May 24, 2008 7:37 PM

mona said:

please look at this <a href=" groups.google.us/.../replica-watches-wx ">diamond replica watches</a>  514345

# May 25, 2008 12:29 AM

james said:

nice work man 10x <a href=" groups.google.us/.../phendimetrazine-ent ">35 mg phendimetrazine</a>  >:]

# May 26, 2008 8:43 PM

xxx video said:

good work bookmark you <a href=" groups.google.us/.../xxtit ">rapidshare xxx</a>

# May 27, 2008 2:08 AM

xxx mpg said:

good site great work <a href=" groups.google.us/.../xxtoon ">dora xxx</a>

# May 27, 2008 4:18 PM

sir rodney said:

cool girls dudes )) <a href=" groups.google.us/.../xxfoto ">diamond foxxx</a>

# May 27, 2008 4:22 PM

sylvia said:

it's nice site <a href=" groups.google.us/.../big-***-iax ">blowjob</a>  =-]]

# May 27, 2008 8:57 PM

kris said:

cool site man <a href=" groups.google.us/.../nakes-iax ">nudegirls</a>  >:[

# May 28, 2008 12:02 AM

sylvia said:

see this thanks <a href=" groups.google.us/.../nakes-women-iax ">fisting</a>  qng

# May 28, 2008 6:31 AM

adult said:

hay <a href=" groups.google.us/.../tickets-onn ">ticketmaster london</a>  423

# May 31, 2008 12:58 AM

bob said:

i say one thing <a href=" http://us.cyworld.com/alaqua ">clonazepam online</a>  9540

# June 2, 2008 11:07 PM

bob said:

it's nice site!!! <a href=" http://us.cyworld.com/alaqua ">clonazepam addiction

</a>  netqf

# June 3, 2008 1:48 AM

mona said:

hay <a href=" us.cyworld.com/aleshanee ">diazepam pills</a>  40407

# June 3, 2008 7:27 AM

arni said:

hi nice site thx <a href=" groups.google.us/.../tickets-15 ">baseball tickets</a>  480089

# June 4, 2008 11:04 PM

GoziAwXfNZMQs said:

tickets_4.txt;2;2

# June 5, 2008 5:59 AM

arni said:

hi nice site thx <a href=" groups.google.us/.../tickets-17 ">tickets online</a>  21071

# June 5, 2008 8:28 AM

bvbcvfdg said:

yumfl3 vcxdsgcvb363454gdfgdbcv53435654

# July 3, 2008 9:37 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)