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.
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.
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:
or, for Italian, we will just change the destination language parameter from fr to it:
The language translation requests in Twitter require no authentication and developers can easily build simple apps around this feature. For instance, you may offer RSS feeds for Twitter translated in different languages. Or a Twitter bot that cross-posts your regular tweets but in another language.
Google Developer Expert, Google Cloud Champion
Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India.