World Line


with 10 comments

Last night I wrote another quick-and-dirty Firefox extension; or rather, I wrote a quick-and-dirty Greasemonkey script based on Jack Hsu’s script which I then used Rochak Chauhan‘s User Script Compiler on to generate a skeleton extension to flesh out. Isn’t involuntary collaboration awesome? 🙂

The script is very simple; it adds a stylish globe icon underneath the “Star” in each tweet on the Twitter timeline. Clicking it makes an API call to Google Translate and adds an overlay containing the translation to English, from whatever language it happens to be in.

Unfortunately, my extension can't make Google Translate suck any less...

I’ve found it very useful, and not just for understanding certain Japanese AV stars. Hopefully someone else shares my passion for Sora — I mean, international culture — and can give it enough feedback on the official add-on site to be able to nominate it for public release. If Send to EidoGo managed to be selected, despite being thoroughly niche, I’m sure Twanslate has nothing to worry about 🙂

Of course, as the product of an evening’s worth of work, it’s not perfect yet. In the interest of full disclosure, here are the outstanding issues.

  • You may have heard that Greasemonkey-based scripts work automagically in Google Chrome. This has some truth to it, but like most things, it’s not that simple. Chrome’s security model is stricter than Greasemonkey’s, so things like hijacking the unsafeWindow.onPageChange() call don’t automatically work. I think I can tweak it to make it work, if it turns out anyone wants it.
  • New tweets that come in with the “X new tweets” notification at the top do not get the translate button, even though they do when you click the “More tweets…” button at the bottom. This is a Twitter weirdness — for some reason their Javascript does call the window.onPageChange() when it’s done adding tweets to the bottom of the timeline, but does not call it when adding tweets to the top, even though the change to the DOM is indistinguishable. Thus it’s much harder to hijack that page event. I’ll figure it out one day. For now, just refresh the page to get it.
  • The output language is not configurable, it’s always English for now. Will be fixed in a subsequent release.

That’s about it. I hope somebody else finds this useful.

Written by Adrian Petrescu

April 20, 2010 at 9:49 pm

Posted in Development

Tagged with

10 Responses

Subscribe to comments with RSS.

  1. I don’t use Firefox anymore and I don’t follow Japanese AV stars, but if I did this would be really cool.

    Would this work in GreaseKit for Safari?


    April 20, 2010 at 10:01 pm

    • Heh, well, luckily there’s a few other non-English-speakers besides Sora Aoi on Twitter 😉

      I’m skeptical it’ll work as-is in Greasekit, just because of the same security issues Chrome has. If you want to give it a try though, the Greasemonkey script itself is in the content/twanslate.js file in the unzipped .xpi.

      Adrian Petrescu

      April 20, 2010 at 11:03 pm

  2. Ironically, I’ve already had to push a bug fix. Version 1.0.1 is out!

    Adrian Petrescu

    April 20, 2010 at 11:00 pm

  3. love this! now I can easily translate all the tweets from my friends and gf’s friends in Japan! 🙂 thanks man keep up the good work!

    Hayden Theriault

    April 21, 2010 at 12:04 pm

  4. i find it cool, but can you develop one ofr chrome? ^^ I follow AV stars on chrome unfortunately XD


    May 25, 2010 at 8:55 pm

  5. […] Twanslate […]

  6. Hey! Great addon which I was looking for works great…

    …BUT! Could you do a quick and dirty update for the new Twitter layout?!

    I would love you forever.


    October 11, 2010 at 2:48 pm

    • Thanks for the feedback 🙂 And yes, that’s at the top of my list, along with a Chrome version. Neither of these two things should be very hard, so look for it soon.


      Adrian Petrescu

      October 11, 2010 at 2:52 pm

      • Awesome! Looking forward to it 😀

        Good karma on its way to you X


        October 13, 2010 at 11:57 am

  7. Hello!
    Have you had any time to work on this?


    January 10, 2011 at 2:37 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: