Pular para o conteúdo

Adding a Locale

Este conteúdo não está disponível em sua língua ainda.

Adding a display language to TomoriBot touches four disjoint surfaces: runtime strings under src/locales/, seed-catalog metadata, the documentation site, and the repository README. This guide defines which of those are required, which are optional, and the order to work in.

Every page here assumes src/locales/en-US/ is open beside you. English is the canonical key structure, and a translated tree that invents keys is a bug rather than a translation.

Required And Optional Tiers

A locale can ship useful with only the required tier. Nothing in the optional tier blocks a release, and everything optional degrades to English rather than to a broken surface.

SurfaceTierDegrades to
src/locales/{code}/** (UI strings)RequiredPer-key English fallback
Protocol keys inside the locale treeRequired and frozenNo fallback: historical embeds stop matching
general.language_name, general.defaults.bot_name, general.defaults.base_trigger_wordsRequiredThe locale code itself, the env default, and the English trigger list
docs/{locale}/** (translated pages)Optional, recommendedEnglish content with noindex
.github/README_{code}.mdOptional, recommendedThe English README
Seed i18n descriptionsOptional, recommendedEnglish description
tools.intent_packsRecommendedThe union drops to the packs that do exist
Persona voice authoringOptional per locale, required for the shipped rosterEnglish preset content

Only en-US and ja are authored today. The eight target locales (pt-BR, es-419, fr, zh-TW, zh-CN, vi, ru, ko) are registered in the shared docs configuration and are waiting for their trees.

Definition Of Done

  1. The tree exists at src/locales/{code}/ under a valid Discord locale folder name.
  2. general.language_name is the language’s own name, not a translation of “English”.
  3. Every key in src/locales/en-US/ has a counterpart, or is left out deliberately for the English fallback.
  4. Protocol keys are reviewed before the locale’s first release, then frozen.
  5. tools.intent_packs entries are authored as native phrasing rather than translated English.
  6. The docs tree and translated README are optional; the guide to publish them is Documentation and README And Repo.
  7. The full gate sequence in Verification passes.
  8. The bot boots and registers commands. An invalid locale code fails registration for every command, and no script catches it.

Shared Files And Disjoint Work

Locale work is designed to be split across agents that never edit the same file. Each locale owns src/locales/{code}/**, docs/{locale}/**, and .github/README_{code}.md, and none of those paths is shared with another locale.

The remaining shared files are pre-staged so a translation lane does not have to edit them:

Shared filePre-staged for every target localeWhat a locale lane still does
src/constants/docsLocales.tsThe locale row with its endonym and description budgetAdd locale-owned draft and translation notices, then flip docsTree to true when the page tree lands
apps/landing/src/pages/index.astroProduct-site language links derived from the locale tableNothing
apps/docs/public/_redirectsThe two-line locale root pairNothing
README.md language switcherThe locale’s endonym is staged as plain textReplace that endonym with the locale README link once the file lands
src/db/seed/catalog/**One i18n map per entryOne dedicated lane owns all locale keys

The docsTree flag is the publish switch. While it is false, the docs build registers no route, no sidebar, no sitemap entry, and no hreflang alternate for that locale, and the bot’s docs links stay on English. A pre-staged locale root serves a 404 until its tree exists, which is the honest answer for a URL with no content behind it.

Seed catalogs are the one genuine exception: models.ts, naiPresets.ts, and systemPrompts.ts hold every locale’s descriptions in the same three files. Per-locale lanes must not edit them concurrently. One dedicated worker adds every locale’s i18n entries after the glossaries are accepted, which is why Seed Catalog describes a hand-off rather than a per-locale edit.

One in-tree edit is deliberately left to the moment a locale publishes: the hardcoded absolute docs URLs inside src/locales/{code}/** move from /en/... to /{code}/... once that locale’s page tree exists. It is a run over the lane’s own files rather than a shared-file change, and Documentation names the files that carry URLs today.