How do telegram determine user language

Viewed 2710

API object User has property language_code - how do Telegram determine user's language, and how do I change it?

I wish to create response for user based on language_code language, but I am not sure I can trust this value, because fore example my language_code is 'en', but for the chatting or UI I am using another one!

1 Answers

Each Update from Telegram contains User information (in Message, in InlineQuery or some other). This language_code is based on which language is set as default on user's device or set for Telegram app. You can trust it.

But some users may want to change a language just for your bot. For that you can add your custom "Settings" to your bot menu, with all languages you support.

Related