- Complete Spanish (neutral Latin American, Paraguay friendly, no inverted marks) and Dutch catalogs, including the Mini App and owner texts - Command menus per language in three scopes (private, group members, group admins); per-chat menus follow a user's /language and a group's /grouplang, from chat and from the Mini App - Bot name, description and short description per language, sent only when the catalog text changes (TELEGRAM_SET_PROFILE) - Dates from the catalog, numbers, sizes and durations per locale - Pseudo-locale en-XA generated from English (I18N_PSEUDO), owners only - Catalog checks: completeness, placeholders, tags, commands, plurals, Telegram length limits, untranslated text, unused and missing IDs - CI workflow; make i18n-check; docs/TRANSLATING.md - Test fix: the queued-download helper could match another chat's status Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3.6 KiB
Translating the bot
Every text the bot and the Mini App show lives in one catalog per language
in locales/. English (en.toml) is the source. Spanish (es.toml) and
Dutch (nl.toml) ship complete.
How a catalog looks
[status]
queued = "In the queue. Position {{.Position}}, about {{.Wait}}."
[unit.minutes]
one = "{{.Count}} minute"
other = "{{.Count}} minutes"
- A table plus a key is a message ID:
status.queued. {{.Name}}is filled in by the bot. Keep it exactly as it is; you may move it within the sentence.- A table whose keys are
one,other(and for some languagesfew,many, ...) is a plural. The bot picks the form fromCountusing the CLDR rules of the language. Give at leastoneandother. - Most chat texts are Telegram HTML. Keep
<b>,<i>,<code>and the line breaks. Do not add new tags. - Commands (
/dl,/help) and the arguments shown in<code>examples (/spending admins) are not translated: the bot only understands them as they are. - The
[app]table is the Mini App. It is plain text, no HTML. [menu]is Telegram's command menu (up to 256 characters each, one line).[profile]is the bot's name (64), the description shown in an empty chat (512) and the short description on the profile (120).[format]says how dates are written: twelve short month names, and the order of day, month, year and time.- Do not use the words
id,description,hash,leftdelim,rightdelim,zero,one,two,few,manyorotheras a key name. The library reserves them. - No em dashes anywhere.
Adding a language
-
Copy
en.tomlto<code>.toml, where the code is a two-letter ISO 639-1 language code (pt.toml,de.toml). Telegram publishes menus and profile texts per two-letter code only. A regional catalog (pt-BR.toml) works for messages, but shares the menu of its base language. -
Translate every value. Change
language.nameto the language's own name for itself ("Português"). -
Run the checks:
make i18n-checkThey fail on a missing or extra message, a changed placeholder, tag or command, a missing plural form, a text over Telegram's length limit, an em dash, and on longer texts left identical to English.
-
Restart the core. The new language shows up in
/language, in the Mini App, in the menus and on the bot's profile. Users whose Telegram is set to that language get it without doing anything.
Without a restart: run the core with LOCALES_DIR=/path/to/locales and
send /reload i18n as an owner. A catalog that fails to load leaves the
old ones in use and says why.
A right-to-left language (Arabic, Hebrew, Persian, Urdu) needs nothing extra. The Mini App mirrors its layout by itself.
Checking a translation in place
I18N_PSEUDO=true adds a pseudo-locale, en-XA: English with every
letter accented and every text in brackets, a third longer. Owners can
pick it with /language or in the Mini App. Text that still reads as
plain English while it is on did not come from the catalog; text cut off
before its closing bracket has too little room.
The Spanish catalog
Neutral Latin American Spanish, with words that read naturally in
Paraguay: "tú" forms, "enlace", "descargar" and "bajar", "billetera",
"fila" for the queue, "factura" for a Lightning invoice. Questions and
exclamations are written without the opening ¿ and ¡; the checks
enforce that.
The Dutch catalog
Informal ("je"), as most Dutch apps are. "Pas", "tegoed", "factuur", "wachtrij"; "wallet" is left as it is, as Dutch Lightning users say it.