Friday 5 July 2013

How Translated Tweets Work?

Twitter has recently added a helpful translation feature to help you understand the text of tweets that are not written in your native language. The language translation feature is internally powered by the Bing Translator.

If you would like to give it a try, go to @MuhammadMorsi’s Twitter page, expand any tweet and click “View Translation.” Twitter will translate the tweet from Arabic to your language.
translated tweets

How Twitter Translates Tweets

Internally, when you click the Translate link, Twitter makes a simple http request with the ID of that particular tweet and the destination language (in our case, English). The response, in JSON, contains the translated text.
https://twitter.com/i/translations/show.json?dest=<LANG>&id=<TWEET_ID>
Twitter has rolled out the translation feature to select accounts but you can actually make translation requests for any tweet as long as the Twitter account is public.
For instance, if you wish to translate this tweet (ID: 344115057778642945) from English (en) to, say, German (de), the request would be:
https://twitter.com/i/translations/show.json?dest=de&id=344115057778642945
or, for Italian, we will just change the destination language parameter from fr to it:
https://twitter.com/i/translations/show.json?dest=it&id=344115057778642945
The language translation requests in Twitter require no authentication and developers can easily build simple apps around this feature. 

No comments:

Post a Comment