How do telegram determine user language
Asked Answered
A

1

7

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!

Appoggiatura answered 7/9, 2020 at 13:11 Comment(0)
D
7

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.

Dissident answered 8/9, 2020 at 8:30 Comment(1)
I just tried it, and language_code gives me system language, ignoring language I set in telegram settingsTerrijo

© 2022 - 2024 — McMap. All rights reserved.