# Guide — Translations

The **Translations** page (bot, **Tools** tab) holds one table per bot: a **key** (`shop.bought`) and one **text per language**. Commands, workflows and scripts ask for a key and get the text in the right language, so an error or a reply is written in the language of the person who triggered it.

## How the language is chosen

1. The language of the person (slash commands, buttons, select menus, forms, context menus).
2. The language of the server, only for these interactions and only when Discord provides one (Community servers: `interaction.guild_locale`).
3. The **default language** of the bot (see below): it is the reference language of your texts.
4. An invisible safety net: English (`en-US`, then `en-GB`), so the texts of ready-made modules (written in `en-US`) never show as raw keys in a bot that speaks another language. It is not a setting.

Prefixed text commands, events, scheduled tasks and inbound webhooks have no person and no interaction: they use the bot's default language, then the safety net (the preferred language of a Discord server is `en-US` by default, so it is never used here). A language without a text for the key is skipped; a key that exists nowhere is returned as is, with a line in the bot's logs. A translation never makes a script fail.

All **32 languages** Discord knows are available: `id`, `da`, `de`, `en-GB`, `en-US`, `es-ES`, `es-419`, `fr`, `hr`, `it`, `lt`, `hu`, `nl`, `no`, `pl`, `pt-BR`, `ro`, `fi`, `sv-SE`, `vi`, `tr`, `cs`, `el`, `bg`, `ru`, `uk`, `hi`, `th`, `zh-CN`, `ja`, `zh-TW`, `ko`. The default language of the bot is required on every key you create (`en-US` when you have not chosen one). Keys of ready-made modules (`mod.*`) are exempt: their source text stays in `en-US`.

### Default language

You choose the default language of the bot in the **Languages** page of Translations. It is the reference language and the final fallback of your texts: it is used when neither the person's language nor the server's language has a text, and it is the language every new key must have. An existing key without a text in the default language is never refused: it is flagged **To complete** (filter and badge). Changing the default language deletes and blocks nothing. New bots use `en-US`. The default language must be one of the 32 Discord languages and be enabled: removing it from the enabled languages puts the default back to `en-US` (texts are never deleted). It is stored as the optional field `defaultLocale` of the `translations` section (written only when it is not `en-US`).

### Similar languages

The option **Use similar languages** (on by default, field `useSimilarLocales`, written only when turned off) makes each step try the close variants of its language before moving to the next step: `en-GB` for `en-US` and the other way round, `es-419` for `es-ES`. `pt-BR` has no variant among Discord's 32 languages. Turned off, only the exact language counts at each step (the default language and the English safety net still apply). The order stays: person (and variants), server (and variants), default language (and variants), then the safety net `en-US`, `en-GB`.

Simplified and Traditional Chinese (`zh-CN`, `zh-TW`) are written differently and no longer replace each other: a person using `zh-TW` is never shown a `zh-CN` text unless it is the default language. (Before, `zh-TW` fell back to `zh-CN`.)

## Using a key

| Where | Syntax |
|---|---|
| BibiScript | `$t[key;name=value;count=3]` or `$t[key;first;second]` |
| BibiScript, forced language | `$tIn[fr;key;name=value]` |
| BibiScript, helpers | `$tHas[key]`, `$locale`, `$guildLocale` |
| JavaScript | `bc.t('key', {name: value, count: 3})`, `bc.t.in('fr', 'key', {…})`, `bc.t.has('key')`, `bc.locale`, `bc.guildLocale` |
| Visual graph | the **Translate** action; its result is `((action.<key>))` |

## Text syntax

A text is plain text with a subset of ICU MessageFormat:

```
{user} bought {item} for {price, number} coins.
{count, plural, one {# item} other {# items}}
{role, select, admin {Administrator} mod {Moderator} other {Member}}
```

Plural categories follow the rules of each language (CLDR): Polish needs `one`, `few`, `many`, `other`; French `one`, `many`, `other`; Japanese only `other`. The editor shows one line per required category and a preview with the number of your choice.

## Limits

- 100 keys per bot (1000 with Premium), 2000 characters per text, keys of `[a-z0-9_.-]`, 64 characters at most.
- Keys starting with `mod.` belong to ready-made modules.
- Languages are not limited.

## Slash command names and descriptions

Names, descriptions, options and choices of a slash command can also be translated (command editor, **Languages** panel, or the **Commands** tab of the Translations page). They follow Discord's own rules (lowercase names of 1 to 32 characters, descriptions up to 100 characters) and are published with the command at the next Discord synchronization, after its preview.

## From the MCP and the Copilot

The tools `translations` (read; filter the keys missing in a language) and `save_translations` (`set_key`, `delete_key`, `set_locales`, `set_default_locale`, `set_use_similar_locales`, `import`) do everything the page does, with the same checks and limits. `translations` also returns `default_locale` and `use_similar_locales`. The REST API has `PUT /api/v2/bots/{botId}/translations/default-locale` (`{locale}`) and `PUT /api/v2/bots/{botId}/translations/similar-locales` (`{enabled}`).
