---
title: Internationalization
subtitle: Write source content under pages/ and put translations at the same path under translations/<lang>/; translate navigation labels with labels.yml. Write translations by hand or translate incrementally with AI.
description: Internationalization in ButterIX — the languages config, the translations directory convention, labels.yml, fallback for missing translations, language switching and hreflang, the biti translate command and translation memory, glossaries, AI translation on the platform, and current limitations.
---

<Tip>
  This site's default language is Simplified Chinese, with an English version as well. Click the language switcher in the header, or prefix the URL with `/en`, to see the English translation of the same page.
</Tip>

## Configure languages

```yaml title="docs.yml"
languages:
  - lang: zh
    default: true
    display-name: 简体中文
  - lang: en
    display-name: English
```

- The language marked `default: true` (or the first entry if none is marked) is the **default language**: its URLs have no prefix and it is used for the home page.
- The **source language** is the language that files under `pages/` and the text in `docs.yml` are written in. It is usually the default language; when they differ, mark it with `source: true`, see [Default language other than the source](#default-language-other-than-the-source).
- Other languages get a `/<lang>` prefix: `/guides/get-started/quickstart` → `/en/guides/get-started/quickstart`.
- `display-name` is the name shown in the language switcher; a built-in name is used when omitted.
- UI text (search, copy, previous / next, feedback, table of contents, and so on) is built in for many languages, including Simplified Chinese, Traditional Chinese, English, Japanese, Korean, Spanish, French, German, Portuguese, Russian, and Italian, and switches automatically with the page language.
- Arabic, Hebrew, Persian, and similar languages automatically use right-to-left layout (`<html dir="rtl">`).

`translations:` is equivalent to `languages:`; either works.

### Default language other than the source

If the originals are written in Chinese but visitors should see English by default, make English the default and mark Chinese as the source with `source: true`:

```yaml title="docs.yml"
languages:
  - lang: zh
    source: true
    display-name: 简体中文
  - lang: en
    default: true
    display-name: English
```

No files move: originals stay in `pages/`, English translations stay in `translations/en/`, and `labels.yml` is still keyed by the original text. Only the URLs change:

| Page | Before | After |
|---|---|---|
| English | `/en/guides/quickstart` | `/guides/quickstart` |
| Chinese | `/guides/quickstart` | `/zh/guides/quickstart` |

- The platform redirects old `/en/…` links to the URL without a prefix.
- Links without a prefix, which used to open Chinese, now open the English page.
- Content without a translation shows the original in the default language; other languages show the default language first. See [Missing translations](#missing-translations). Fill in the default language before switching.

## Directory convention

<Files>
  <Folder name="my-docs" defaultOpen>
    <File name="docs.yml" />
    <Folder name="pages" defaultOpen>
      <File name="introduction.mdx" comment="Source (Chinese)" />
      <Folder name="guides">
        <File name="webhooks.mdx" />
      </Folder>
    </Folder>
    <Folder name="translations" defaultOpen>
      <File name="glossary.yml" comment="Optional: AI translation glossary" />
      <Folder name="en" defaultOpen>
        <File name="labels.yml" comment="Navigation labels" highlighted />
        <Folder name="pages" defaultOpen>
          <File name="introduction.mdx" comment="Translation: same path as the source" highlighted />
          <Folder name="guides">
            <File name="webhooks.mdx" />
          </Folder>
        </Folder>
      </Folder>
    </Folder>
  </Folder>
</Files>

A translation is a complete MDX file (including frontmatter). The page's `title`, `description`, and so on come from the translation's frontmatter.

### Missing translations

When a page has no translation, the page **still exists** in that language and shows, in order:

1. the translation in that language;
2. the translation in the default language (when it differs from the source language);
3. the original.

For example, on a site written in Chinese whose default language is English, pages without a Japanese translation show English, and Chinese only if there is no English either. Pages, API overview pages, and changelog entries fall back as whole files; OpenAPI text, labels in `labels.yml`, and external links fall back one by one. The source language always shows the original.

A page's name in the navigation is, in order: `sidebar-title` in the translation's frontmatter, the translation in that language's `labels.yml` (or overlay file), the title of that language's translation, and only then the navigation title in the default language or the original. This keeps the navigation structure consistent across languages with no dead links, and links between pages stay in the current language.

### Links and images

- Relative links between pages (`./quickstart.mdx`) are written as usual in translations; the builder maps `translations/en/…` back to the source path and then resolves it to the English page's URL.
- Use project-root paths starting with `/` for images (`/assets/diagram.svg`) so translations and sources share the same assets.
- Site URLs starting with `/` stay in the current language (and version). Besides pages, that covers the home page `/`, `llms.txt`, `llms-full.txt`, changelog feeds (`/changelog.rss` and so on), the `.md` version of pages, and short addresses from `redirects`; `?query` and `#anchor` are kept.
- When the target doesn't exist in the current language and version, the default version in the current language is used, then the URL as written. Files that exist once, such as `sitemap.xml`, aren't affected.
- To link to a specific language or version, write its code or URL segment; the default language and version work too: `/zh/guides/x`, `/v1/guides/x`.

## labels.yml: translate navigation and site texts

Navigation titles and texts such as the header and footer are written in `docs.yml` (or version files) in the source language. `translations/<lang>/labels.yml` is a "source → translation" mapping that covers:

**Navigation**

- Tab `display-name`s
- Section, page, and link titles
- `folder` `title`s and auto-generated page titles
- `api` section and `changelog` titles
- Version and product `display-name`s, and product `subtitle`s
- Section and page `tags` (each item on its own, including those in the original frontmatter)

**Site texts**

- The site name `title`, `description`, `seo.title-template`, and the text next to the logo `logo.right-text`
- The announcement `announcement.message`, and the `text` of header links and buttons
- The footer's `text`, column titles, link texts, and badges (except a custom footer, `footer.file`)
- The Ask AI greeting `ai.greeting`, suggested questions `ai.suggestions`, and notice `ai.disclaimer`
- The `llms.txt` description `agents.llms-txt.description`

```yaml title="translations/en/labels.yml"
指南: Guides
组件: Components
API 参考: API Reference
更新日志: Changelog
开始: Get started
简介: Introduction
快速开始: Quickstart
```

Texts not listed in `labels.yml` fall back in the order of [Missing translations](#missing-translations). When you switch to a language in the editor, **Docs settings** shows how many site texts in each category still have no translation.

### Localized external links

External addresses in `docs.yml` (`http(s)://`, `mailto:` and so on) can be swapped per language too: add the original address as the key and that language's address as the value in `labels.yml`. This works for the logo link, header links and buttons, the announcement link, tabs that link elsewhere, and footer links, badges and social icons.

```yaml title="translations/en/labels.yml"
https://acme.com/zh: https://acme.com/en
https://acme.com/zh/signup: https://acme.com/en/signup
https://x.com/acme_zh: https://x.com/acme
```

Addresses you don't list keep the original. Links within the site that start with `/` don't need entries: they go to the matching language's page automatically. In the editor, switch to that language and the address fields of external links under **Docs settings** let you enter this language's address directly; leave one empty to keep the original.

### Per-language navigation files

A configuration file can be mirrored under `translations/<lang>/` at the same path, carrying only what changes in that language: `docs.yml` maps to `translations/<lang>/docs.yml`, and a version or product navigation file (such as `versions/v2.yml`) to `translations/<lang>/versions/v2.yml`. These win over `labels.yml`.

```yaml title="translations/en/versions/v2.yml"
tabs:
  guide:
    display-name: Guides
navigation:
  - tab: guide
    layout:
      - section: Get started
        contents:
          - slug: intro          # matched to the original entry by slug
            page: Introduction
            tags: New
          - page: Pricing        # no slug: matched by position
            tags: [Limited, Hot]
```

- **Matching entries**: an entry with a `slug` matches the original entry whose slug ends with the same segment; one without matches by position; tabs match by id. URLs, file paths and structure always come from the original; only what is shown changes.
- **What can change**: section, page and link titles (`section`, `page`, `link`), the titles of `api` sections, `changelog` and `folder` (`api`, `title`), tab `display-name`s, and `tags` with their `tags-*` settings.
- **The root `docs.yml` overlay** can also set the `display-name` of `versions` and `products` (and a product's `subtitle`, matched by order), and `navbar-links`, which replace that language's header links as a whole.
- Write only the fields that change; the rest come from the original and are then translated with `labels.yml`. A language without its own file uses the default language's, as with [missing translations](#missing-translations).
- Page frontmatter still wins: `sidebar-title`, `tags` and so on in a translation's frontmatter beat the values here.

## Translate API specs

Text on endpoint pages comes from the OpenAPI spec. Put its translation at the same path under `translations/<lang>/`, in the same format; **it can be partial**:

```yaml title="translations/en/openapi/payments.yml"
tags:
  - name: Payments
    x-displayName: Payments
paths:
  /payments/{id}:
    get:
      summary: Get payment
      description: Returns a payment.
      parameters:
        - name: id
          in: path
          description: Payment id
```

- Only its text is used: `summary`, `description`, `title`, `x-displayName`, code sample `label`s, enum descriptions, and `example` / `value` samples. Endpoints, parameters, and URLs always come from the original spec, so an outdated translation can't change the API.
- Anything not translated falls back in the order of [Missing translations](#missing-translations). Lists are matched by `name` (plus `in` for parameters) or `url`, so adding or removing items in the original doesn't break translations.
- Endpoint page URLs are the same in every language, whatever the translation.
- The API overview page (`summary`) is translated like any page, at the same path under `translations/<lang>/`.
- In the console: switch the preview to a language, open any endpoint page, and click **Create … translation** or **Edit … translation** at the top. A new one starts with every original text as a draft. You can also [click text on the page](../api/openapi.mdx#edit-text-in-the-editor) to edit its translation; clear it to show the original again.
- `biti translate` and AI translation on the platform translate spec text too; existing translations are kept until the original text changes.

## Translate changelogs and blogs

Put an entry's translation at the same path under `translations/<lang>/`, with the same file name, for example `translations/en/changelog/2026-11-20-v1.mdx`:

- Title, tags, description, and body come from the translation. Date, URL, order, hidden, and draft always come from the original, so every language lists the same entries at the same URLs.
- Entries without a translation fall back in the order of [Missing translations](#missing-translations). A translation with `draft: true` counts as missing, so you can commit a half-finished one.
- Tags are written per language; the filter lists the tags of the entries in the current language.
- The layout (timeline, classic, or blog) comes from the original `overview.mdx`. If the translated overview has no `authors`, the original's are used.
- In the console: switch **Viewing language** and click an entry under the changelog to create or open its translation.
- `biti translate` and AI translation on the platform translate entries and their tags too.

## Language switching and hreflang

- The language switcher jumps to the **same page** in the other language (matched by tab id, section title, and page title), not to the home page.
- Every page's `<head>` includes `<link rel="alternate" hreflang="…">` for all language versions, plus `hreflang="x-default"` pointing to the default language.
- Every URL in `sitemap.xml` carries language alternates as `xhtml:link`.
- Each language has its own `llms.txt` and `llms-full.txt` (`/en/llms.txt`).
- Ask AI prioritizes content in the page's language and answers in the page's language.

## Translate automatically with biti translate

```bash
export ANTHROPIC_API_KEY=sk-ant-...
biti translate
```

The command translates every source page that appears in the navigation into every language other than the source, writes them to the same path under `translations/<lang>/`, and fills in `labels.yml` (navigation titles and site texts; the site name is left to you). Existing entries, comments, and order in `labels.yml` are kept.

<ParamField path="--to" type="string">Target languages, comma-separated, for example `--to en,ja`. Defaults to every language in `docs.yml` other than the source.</ParamField>
<ParamField path="--provider" type="anthropic | deepseek | openrouter" default="anthropic">Model provider. The matching key is read from the `ANTHROPIC_API_KEY`, `DEEPSEEK_API_KEY`, or `OPENROUTER_API_KEY` environment variable.</ParamField>
<ParamField path="--model" type="string">Model id; defaults to the provider's default model (`claude-opus-5-5` for Anthropic, `deepseek-flash` for DeepSeek, `~deepseek/deepseek-flash-latest` for OpenRouter).</ParamField>
<ParamField path="--only" type="string">Only translate pages whose path contains this string, for example `--only pages/guides/`.</ParamField>

### Incremental translation and translation memory

- Pages are split into top-level blocks (paragraphs, headings, lists, components…), and each block is stored in `.biti/translation-memory.json` keyed by its content hash.
- When a translation stops halfway, what is already translated is kept, and running it again continues from there.
- On later runs, unchanged blocks reuse the memory and only new or modified blocks are sent to the model — changing one sentence means translating only that sentence.
- Code blocks, `import` / `export` statements, `<CodeBlock>` / `<CodeGroup>`, and block-level math are not translated.
- `title`, `subtitle`, `description`, and `sidebar-title` in frontmatter are translated.
- Hand-written `labels.yml` entries take precedence; AI only fills in missing labels.

<Warning>
  Commit `.biti/translation-memory.json` to your repository, or runs in CI or on other machines will retranslate everything. The `.gitignore` generated by `biti init` ignores all of `.biti/`; to commit the translation memory, change that line to `.biti/*` and add a line `!.biti/translation-memory.json`.
</Warning>

### Glossary

Set fixed translations for each language in `translations/glossary.yml`, and the model follows them strictly:

```yaml title="translations/glossary.yml"
en:
  站点: site
  部署: deployment
  预览部署: preview deployment
ja:
  站点: サイト
  部署: デプロイ
```

## Manage languages in the console

<Steps>
  <Step title="Turn on or add languages">
    Open the editor, go to **Docs settings → Navigation**, and under **Languages** click **Turn on languages** (on a single-language site) or **Add**, then enter a language code (such as `en`, `ja` or `zh-TW`) and a display name. When turning languages on, also enter the language of the current content; it becomes both the default and the source language.
  </Step>
  <Step title="Translate pages and navigation">
    Switch the navigation tree to the language and open a page to create its translation (the first time, the original is copied as a draft translation). Translations of navigation titles, header and footer text, and external links are entered under **Docs settings** while viewing that language, and are saved to `translations/<lang>/labels.yml`.
  </Step>
  <Step title="Adjust and remove">
    Each language's display name can be changed, and its **⋯** menu makes it the default, moves it up or down, or deletes it. The language switcher follows the list order; reordering doesn't change the default language. Deleting only stops offering the language; translations under `translations/<lang>/` are kept. Changing the default language only changes each language's URLs; source and translation files stay as they are, and the source language is labeled **Source**. The default and source languages can't be deleted. **Viewing language** above the navigation tree only changes which language you view and edit, not the default.
  </Step>
</Steps>

## AI translation on the platform

Sites hosted on the ButterIX platform (hosted repository or connected Git) can translate the whole site with one click in the visual editor:

<Steps>
  <Step title="Configure Ask AI">
    Translation uses the site's Ask AI settings (provider, model, and key); see [Ask AI](./ask-ai.mdx).
  </Step>
  <Step title="Start translating">
    The platform creates a `translate/…` branch, runs incremental translation as a background job reusing the translation memory in the repository, and commits to that branch when done.
  </Step>
  <Step title="Review and publish">
    Open the branch in the editor, review the translation page by page, and publish when you're satisfied (merge into the production branch and deploy).
  </Step>
</Steps>

The corresponding APIs are [`POST /sites/{site}/editor/translate`](/api-reference/editor/translate) and [`GET /jobs/{id}`](/api-reference/jobs/get-job).

## Current limitations

The following content is not yet switched by language and shows the source text in every language:

| Content | Notes |
|---|---|
| Snippets | All languages share the same file; use `<If locales>` to differentiate |
