jlelse’s Blog

Thoughts, stories and ideas

About Telegram’s new translation feature

Published on in ✍️ Posts
Short link: https://b.jlel.se/s/54c
Share onlineTranslate

Telegram is developing updates and new features like crazy, they just released the 12th major update this year. One of the new features is the translation of chat messages from a foreign language to your own.

I was wondering what API Telegram was using there. After all, with the large number of Telegram users, the Google Translation API would cost a fortune.

So I did some googling and finally came across this article: “How Telegram Messenger circumvents Google Translate’s API”.

Telegram seems to simply use a hidden Google Translate API that they probably discovered via reverse engineering. By using different user agents, Telegram tries to avoid rate limits. Using tricks like string concatenation, Telegram also tries to trick the app review process in the Google Play Store.

If you google a bit further, you can also find this article that describes in a bit more detail how you could use the Translation API without creating an API key in the Google Cloud and then paying high fees: “Google Translation API Hacking”.

That’s how Telegram proceeds on Android, the question still remains how it looks on iOS. Since Telegram clients are open-source, I did a search on the corresponding repository. It seems that there is no need to use the Google API on iOS, since iOS offers a translation app and a context menu entry for system-wide translations. The translation is then supposed to take place via “machine learning” directly on the device. That’s why iOS 15 is also required for the translation feature with the iOS Telegram app. The source code for using this feature is in this file.

I am curious when Google will discover the use of the hidden API and try to put a stop to it. Perhaps Telegram will also discover another way to implement translations on Android.

Tags:

Jan-Lukas Else
Interactions & Comments