Skip language selection under specific circumstances
When you initiate a conversation with the bot, the bot first asks in which language it should communicate in.
For convenience reasons, we already detect the language of the user based on the language that Telegram reports back to us and ask them in the language that we detected. If they do not speak the detected for some reason very well, it's OK, as they can read their own language.
This language selection screen makes sense if the user uses Telegram in English, as that is done a lot in other places if the locales are subpar or if a translation simply doesn't exist. From my experience, I've seen people using such interfaces without even necessarily knowing the contents of what is being said.
Therefore, it makes perfect sense to ask people that question in English.
However, it does not make absolute sense to consider that, say, a non-German-speaking Russian person would be using Telegram in German, apart from the edge case of "I switched my phone's language to German so that I can learn it", something that I've experienced myself and heard from multiple other people after I asked them about this.
General approach
- Split
start_command
into a separate function, call new functionchange_lang
if the menu is to be shown. - If this issue is to be solved using a "conversion table",
titles.py
should probably be used.
But when should the menu be shown?
- The user's locale is in English.
- We try to figure out if the user's locale has available translations. If yes, immediately call
welcome_command
with the correct callback. If not, show the language prompt in English. - Make sure to include an additional button in
welcome_command
that allows the user to use the "Change Language" menu as they please.
Why is this hard to figure out?
- Potential mismatches between locales reported by Telegram and the translations we use may cause errors. (e.g. locale not found, or wrong locale being interpreted). A person who uses e.g. Chinese as their language of choice could want to use the Taiwan variant of the translations for the bot, but any intervention may result to e.g. Traditional or Simplified Chinese being used. The wrong set of translations may be selected, even if both versions exist. (This is completely hypothetical and is meant to illustrate the problem, haven't tested/confirmed this.)
- Telegram uses the IETF standard for naming locales, Firefox shares some details about their side here.