twt­lang: un ser­vice de tra­duc­tion en util­isant Twit­ter et Google.

Apr 16 2010

I made another Twit­ter… thing. In the tra­di­tion of twt­dict, I give you: twt­lang. What does twt­lang do? I’m glad you asked.

twt­lang mashes up Twit­ter and the Google Trans­late ser­vice. It works pretty much the same way twt­dict does. Send it a phrase, tell it what lan­guage you want it in, and it will send back the trans­la­tion, if it can.

Since a sen­tence is a lit­tle more neb­u­lous than a sin­gle word, I had to change the way the ser­vice parses the tweets. The struc­ture is a lit­tle more impor­tant. Basi­cally, they have to be sent like this:

@twtlang “I would like this in French, please.” fr

You’ll get this in a Direct Message:

Je voudrais que cela en français, s’il vous plaît.

If you tack a @ on the end, you’ll get an @reply instead, just like twtdict.

Obvi­ously there are some lim­i­ta­tions. For one, the Google trans­late ser­vice will detect what lan­guage the request is in, so I only needed to spec­ify the tar­get lan­guage. Unfor­tu­nately, it doesn’t do so well on shorter phrases. I requested a Ger­man trans­la­tion of “shit” and all I got back was “shit.” (Just tried with French and it worked. Merde.) It seems to work bet­ter with longer phrases. I thought about mak­ing a way to spec­ify the ini­tial lan­guage but didn’t want to get too cryp­tic or “code-y” (as in, @twtlang “trans­late this” en>fr). Or maybe I was just lazy. I don’t know. I might change it if necessary.

Also, it does noth­ing for pro­nun­ci­a­tion. So if you want to know how to say “什么他妈的这是否说的?”, you’re on your own. I sup­pose if you are actu­ally in China, you could just show it to some­one, if your phone will dis­play the char­ac­ters. Mine doesn’t dis­play them in text mes­sages. Haven’t tried Opera mobile yet.

Like twt­dict, the ser­vice is based on a cron job that runs every 5 min­utes, to keep from get­ting black­listed by Twit­ter. Also like twt­dict, I’ll apply for whitelist­ing if necessary.

You can find a list of avail­able lan­guages on the twt­lang page. (Inter­est­ingly, if I request a full list of lan­guages from Google, Esperanto is listed, but it doesn’t work, and Esperanto is not listed in the drop down at the Google Trans­late site.) They’re pretty much the stan­dard coun­try codes, so you prob­a­bly already know most of the more com­mon ones.

I don’t really know why I made this, other than I thought it’d be inter­est­ing. I may get some use out of it this sum­mer when I head to Man­i­toulin Island, Ontario, Canada for my grandmother’s 80th birth­day. (She’s not Cana­dian. My fam­ily has a cabin on the island.) I haven’t been there in 14 or 15 years but I think there are some French-speaking Cana­di­ans in the near­est town. Maybe I can use this to ask where the bath­room is.

Où est la salle de bains?

No responses yet

Facebook comments:

Leave a Reply