Growing

How to make a Telegram bot speak more than one language

By the Botable team

Telegram sends the user's app language with each update, which is a good default but a poor assumption. Store an explicit preference, keep every user-facing string in one place per language, and let users switch.

Watch it

Telegram hands you the user's language on every message, so you rarely have to ask. Keeping strings in one place is what makes the second language cheap.

Make your bot speak more than one language
Read the transcript

Everything said in the video, in order.

Telegram tells your bot which language each person's phone is set to, before anyone types a word.

A good default, and a bad assumption. The rest of the job is keeping your strings where you can find them.

Ask for both halves in one sentence. A default taken from what Telegram already sends you, and a plain way for someone to overrule it.

The sender's language code rides along with the message, no question asked. Lumen Support keeps it in a column of its own, next to the name and the plan.

Sixty people here and twenty four languages between them, eight on English. Nobody was asked. But that code is the phone's setting, and it can arrive empty.

Default from it, then offer a way out. A language command with buttons, stored against the user I D. Telegram lets you set the command menu per language too.

Keep the words out of the handlers. This greeting sits in a keyed table. Strings buried in the logic are why error messages stay English after everything else ships.

Machine translation is fine for chat replies and help text. Billing is the other kind. A wrong refund line is a dispute, not a typo, so have a person read those.

Default it, let them change it, keep the strings together. Start free at botable dot I O.

All the video guides

The short version

Making a Telegram bot multilingual is mostly a discipline problem rather than a technical one. Telegram includes the user's client language code in the data it sends, which is a reasonable default and a bad assumption, plenty of people run their phone in English and would rather read something else. So the pattern is: default from the language code, store an explicit preference the first time the user sets one, and offer a visible way to change it. The engineering half is keeping every user-facing string in a per-language table rather than inline in the handlers, because a bot with strings scattered through its logic cannot be translated without touching every file, and the ones that get missed are always the error messages. Machine translation is acceptable for chat replies and a real risk for anything legal or commercial, where a mistranslated refund policy is a dispute rather than a typo.

Step by step

How do you pick a starting language?

From the language code Telegram sends with the user's messages. Use it as the default, fall back to your primary language when it is one you do not support, and never treat it as final, it reflects the phone's setting, not necessarily a preference.

How should strings be organised?

In one place per language, keyed by a stable identifier, with the handlers looking up keys rather than containing text. Strings inline in the logic are why partially translated bots exist, the main flow gets done and the error paths do not.

How do users switch?

A /language command with buttons, stored per user id. Make it discoverable, because someone reading the wrong language cannot find a command they cannot read, putting it in the command menu with a globe emoji helps more than it sounds.

Where is machine translation risky?

Anywhere the wording carries obligation: terms, refunds, payment confirmations, safety instructions. Have those reviewed by a person. Conversational replies and help text tolerate machine translation well; a mistranslated refund window does not.

What catches people out

  • The language code is the phone's setting, not a preference, always allow an override
  • Untranslated error messages are the most common gap, because they are written last
  • Right-to-left languages affect layout in Mini Apps, not just the strings

Questions

Should the command menu be translated too?

Yes, setMyCommands accepts a language code, so the menu can be set per language. A translated bot with an English command menu looks half-finished, and that is the first thing a user sees.

How many languages is reasonable to start with?

Two. Every added language multiplies the maintenance of every future feature, and the second one already forces the structure that makes the tenth possible. Add more when the audience is demonstrably there.

Want a bot that does this?

Describe it in plain language and Botable writes the code, gives the bot its own database, deploys it and keeps it running. Everything on this page is handled for you, the token, the webhook, the storage, the hosting.

Build a bot

Keep reading

Bots that use this

All twenty-five guides