Twitter Translation

My friend Britt mentioned today that he was about to launch twitter.jp. How exciting! But I don’t understand Japanese. If only I could easily translate all those tweets in languages I don’t understand.

I played around with Google’s new AJAX Translation API before and I wondered how hard it would be to use that from a GreaseMonkey script. The answer: hard. I’m not sure what the exact problem was but every way I tried to include Google’s APIs into the pages I was manipulating, including creating my own iframe and using document.write failed. In the end I used a static proxy html file (hosted in one of my Amazon S3 buckets for cheap efficiency) with some sneaky cross-site communication (the request goes over in location.hash, the response comes back in window.name).

My script is now up on userscripts.org: twitlator.user.js

To use it simply go to a page listing a bunch of tweets, like the public timeline and find a tweet in a language you don’t under stand. For example:

Click the translate! link and several moments later you’ve got:

Yep. People aren’t posting anything interesting in Japanese either.

I’m pretty sure my script will only work on Firefox 3. I’m using getElementsByClassName which I think wasn’t introduced until Firefox 3. Why aren’t you running it already?

This entry was posted in Default and tagged , , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

2 Comments

  1. Posted July 6, 2008 at 10:20 am | Permalink

    Hey cool !
    I began a french translation of Twitter :
    http://code.google.com/p/twitterfr/

    :)

  2. Posted June 27, 2009 at 8:06 am | Permalink

    Cool. I did a fully featured iPhone Twitter Client using Google API. Details are @ http://tidbit.techievarta.com/tag/twitterworld/ Or in iTunes store http://bit.ly/Z0uaY

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

Subscribe without commenting