How should locales be dealt with?
I finally got the bot to work using the new library that I had to use. It allows me to use callbacks, which help me with asking for the user's platform, then generating a list of locales that are available to that specific platform, without the user having to send a text message that looks like "
English (USA), Linux (32-bit).
Here's a screenshot:
I used the
InlineKeyboardButtons to add the locales, however, they don't all fit in one row.
- Split the locales in different rows?
Problem: In order to be user friendly, you'd have to use the names of the locales that are readable by human beings. In the previous screenshot, more than 5 locales fit in one row, because each locale consisted of 2 characters. I doubt that this is going to work when you have locales that range from "Dutch (Netherlands) a
- Replace locale names with flags?
Problem: Stateless populations, niche locales, countries with more than two official languages or countries with large foreign-speaking populations (e.g. Malta, Canada, etc.).
- Use the user's preferred language on Telegram and just ask for their preferred operating system?
This seems by far the simplest solution to me and simplifies UX, although I haven't sought after implementing it. It simplifies deciding for the language that the bot will communicate in with the user.
Problem: Although it's a bit easier to maintain, it limits available options and forces the user to disclose that information to Telegram, which technically already has access to this information anyways. However, Telegram can be used as a means of establishing a data transfer with encryption (because of "Secret Chats", which are now possible but haven't been explored yet). Also, there may be a locale that could be available on Telegram but not to the bot/the requested program, and vice versa.
- Have the user choose an operating system, and then using a "ReplyKeyboardMarkup" to provide a scrollable menu of options with locales.
Here's how a ReplyKeyboardMarkup would look like:
Problem: Increases complexity, may require dealing with a database that will store metadata about the end user, makes hosting more difficult to other people. When the user clicks on a button in a "ReplyKeyboardMarkup", they have to send a text message, which the bot will have to process. That will break things if the user sends a message with just the locale, without having issued their preferred operating system, unless if the bot generates a menu consisting of keys that looks like
English (USA), Linux (32-bit).
The goal is to:
- not store user information and data.
- accommodate as many people as possible regardless of their locale
ReplyKeyboardMarkup (the series of buttons on top of the keyboard) is to be used, it can only be used once and in the beginning. When the user makes a decision, the bot dynamically generates a new prompt with a new set of buttons, which also stores the previous decision of the user with the help of
InlineKeyboardMarkup's (the buttons under text messages from the bot).