Skip to content

Add i18n to a website or docs site ​

This page is for a documentation site (Markdown or MDX) or a marketing or static site (an Astro website or plain HTML) in one language. The tool translates your page content with the models on your LLM provider and writes one localized copy per language. Your site framework serves those copies and provides the language switcher.

For an app whose UI strings live in t() calls, use Add i18n to a JS/TS app or Add i18n to a Python app instead.

What do you have? ​

Your siteInit templateStart here
Astro Starlight or plain Astroui-starlight / hybrid UI stringsAstro
Docusaurusui-docusaurusDocusaurus
VitePressui-vitepressVitePress
Nextra 4 (Next.js App Router)ui-nextraNextra
Fumadocs 4 (Next.js App Router)ui-fumadocsFumadocs
Plain HTML pagesui-plain-html or docs-plain-htmlPlain HTML apps
No site framework, just a README and Markdown filesdocs-markdown, or any template plus --with-readmeAdd i18n to your README and Markdown docs
Agent prompts

Steps ​

The same shape works for every framework; the details live in the framework guide linked above.

  1. Install the CLI and set the API key: Installation, Provider and API key.
  2. Scaffold: ai-i18n-tools init -t <template> -P <provider>.
  3. Set sourceLocale, targetLocales, and docs[].contentPaths (the pages and folders written in your source language). sourceLocale can be any language. The framework guide shows the right docsOutput.style.
  4. Enable your framework's own i18n so it serves and links the localized pages. Each guide has an "Enable i18n in an existing site" section: VitePress, Docusaurus, Nextra, Fumadocs, Astro.
  5. Run ai-i18n-tools sync (or translate-docs), then build the site.
  6. Check a localized route in the browser. The framework's own locale dropdown is the switcher. For a flat markdown file such as a README, add a link row with languageListBlock.

What gets translated ​

Page bodies always go through the Documents pipeline. Framework chrome (navigation, sidebar, theme labels) is handled in the same run where the framework supports it, not through the separate JSON pipeline.

FrameworkShell and theme stringsHow
Docusauruswrite-translations catalog ({ message, description })docs[].docusaurusCatalogDir plus translate-docs
VitePressTheme, nav, and sidebar catalogdocsOutput.vitepressThemeCatalog plus translate-docs
Nextra_meta.ts sidebar labelsAutomatic with style: "nextra"
NextraTheme dictionary .tsdocs[].nextraDictionaryPath
Fumadocsmeta.json sidebar labelsAutomatic with style: "fumadocs"
FumadocsUI overrides catalogdocsOutput.fumadocsUiCatalog
Astro StarlightBuilt-in UI strings in many localesPages only

Images and screenshots are not translated by translate-docs. For locale-specific files, see Images and screenshots.

Plain HTML ​

Two options, depending on how the page should behave:

  • One page that switches language in the browser: mark the text with data-i18n* attributes and use the UI strings runtime (ui-plain-html). See Plain HTML apps.
  • One translated HTML file per locale: use the Documents pipeline (docs-plain-html). See HTML pages.

A file belongs to one path.

Not your case? ​

Reference for the shared options and per-framework differences: Integrations.

Released under the MIT License.