Friday, 19 June 2009

Translate Persian Twitter messages with Google Translate... automatically!

UPDATE: Cyrus Farivar has refined this quick tutorial. Having trouble with this? Follow his instructions on How to use Google Translate to translate Twitter messages from Persian.

Twitter is being used to provide real-time updates about what's happening in Iran. Following the exciting news about Google Translate now supporting Persian it's now possible to automatically translate Persian tweets into English (or any other Google Translate supported language).

Quick overview

To be able to automatically translate Persian Twitter messages, you will need...

  • The latest version of the Firefox web browser
  • Greasemonkey plugin (a Firefox plugin that allows you to customise web-pages with little bits of Javascript)
  • Google Translate user script for Twitter messages (add Google Translate button to your Twitter page)
  • Make some minor tweaks to the user script (because Twitter switched to HTTPS and the script was written before Google Translate supported Persian)
Step by step guide

1. Download and install the latest version of Firefox. Skip this step if you already run Firefox.

2. Install the Greasemonkey plugin for Firefox (you may need to restart Firefox after this step). Visit the page and click Add to Firefox...


3. Install the Google Translate user script. Visit the page and click Install...


4. Update the user script. It was written before Google Translate supported Persian and before Twitter ran on HTTPS. Do this via the form that appears when you install the script, or select Tools > Greasemonkey > Manager User Scripts. Or right-click the little monkey-face icon in the bottom-right corner of Firefox and choose Manage User Scripts.

5. Add in support for HTTPS by selecting Google Translate and then add in https://twitter.com/* and https://*.twitter.com/* to the list of Include Pages...

6. Edit the user script by clicking Edit in the bottom-left corner on the bottom right (above). Or you can edit google_translate.user.js. Add a new line at line 88 with fa: 'Persian',

7. Save your changes to your script and close the Manage User Scripts box

8. Check Greasemonkey is switched on (you may need to restart Firefox first) by going to Tools > Greasemonkey > Enabled...

9. Go to your Twitter page and login.

10. Find a tweet in Persian from one of your (new?) Iranian friends. Hover your cursor over the tweet and you'll see the favourite and reply icons appear, along with a new friend a lowercase 't'.

11. Click on the 't' icon and your friend's tweet is automatically translated from Persian into English!

Extra

If you don't speak English or want to translate into another language, you can set another language as the default.

This script doesn't just work for Persian/Farsi, it works for all Google Translate supported languages. And it auto-detects them. So, you can add new friends from around the world to your Twitter friends list!

Google Translate's Persian very far from perfect. Bear that in mind when you're using this script!

2 comments:

  1. I can add the https etc. but I can't add the fa:'Persian', .. because I can't find where the script is locally... where would it be installed or how can I search for it so Vista finds it? Any ideas?

    ReplyDelete
  2. It's a file called...

    google_translate.user.js

    But you can edit in Firefox it via Tools > Greasemonkey > Manager User Scripts and selecting Google Translate and then clicking the Edit button on the bottom-left corner.

    ReplyDelete

Comments with links, feedback, etc. greatly appreciated. Spam will be deleted.

Note: only a member of this blog may post a comment.