# 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 ```toml [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 languages `few`, `many`, ...) is a plural. The bot picks the form from `Count` using the CLDR rules of the language. Give at least `one` and `other`. - Most chat texts are Telegram HTML. Keep ``, ``, `` and the line breaks. Do not add new tags. - Commands (`/dl`, `/help`) and the arguments shown in `` 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`, `many` or `other` as a key name. The library reserves them. - No em dashes anywhere. ## Adding a language 1. Copy `en.toml` to `.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. 2. Translate every value. Change `language.name` to the language's own name for itself ("Português"). 3. Run the checks: ```sh make i18n-check ``` They 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. 4. 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.