Translating Documentation
What it does
Section titled “What it does”tyndale translate-docs translates your source documentation from the default language into every locale in tyndale.config.json.
It is designed for docs sites, not app UI strings:
- It reads Markdown and MDX docs from your source docs directory
- It writes translated files using the conventions of your docs framework
- It skips files that are already up to date
- It validates generated docs and retries invalid outputs automatically before reporting a failure
Use the same AI provider setup you use for tyndale translate.
Supported frameworks
Section titled “Supported frameworks”translate-docs currently supports:
- Starlight
- Docusaurus
- VitePress
- MkDocs
- Nextra
Quick start
Section titled “Quick start”npx tyndale translate-docs setupnpx tyndale translate-docstranslate-docs setup detects a supported docs framework in the current project and writes a docs block into tyndale.config.json.
Then translate-docs uses that config to find English source docs and write translated docs to the right place for your framework.
Expected config
Section titled “Expected config”Keep your normal Tyndale config, then add a docs block:
{ "defaultLocale": "en", "locales": ["es", "fr", "ja"], "docs": { "framework": "starlight", "contentDir": "src/content/docs" }}docs.framework must be one of:
starlightdocusaurusvitepressmkdocsnextra
docs.contentDir points at the source docs directory in your default language.
Notes:
defaultLocalemust not appear inlocalestranslate-docsuses framework-specific file extensions automatically--content-diroverrides the configured docs directory for a run
How setup detection works
Section titled “How setup detection works”npx tyndale translate-docs setup scans the current project for supported frameworks.
Detection is based on framework-specific signals such as:
- installed package dependencies
- known framework config files
Current defaults are:
- Starlight →
src/content/docs - Docusaurus →
docs - VitePress →
docs - MkDocs →
docs - Nextra →
pages
For MkDocs, a mkdocs.yml or mkdocs.yaml file is enough for high-confidence detection.
If setup finds multiple candidates, it prefers the first high-confidence match. It then writes the selected framework and content directory to tyndale.config.json.
If you skip setup, translate-docs can still auto-detect in one narrow case: when it finds exactly one high-confidence framework. Otherwise it falls back to src/content/docs unless you pass --content-dir.
Incremental behavior
Section titled “Incremental behavior”translate-docs keeps an incremental state file at the project root:
.tyndale-docs-state.jsonFor each locale and source file, Tyndale stores a hash of the current source doc. On the next run it only retranslates a document when:
- the translated target file is missing
- the English source file changed
- you pass
--force
That means a normal run only processes missing or changed docs.
To retranslate everything:
npx tyndale translate-docs --forceWhere translated files go
Section titled “Where translated files go”Tyndale writes translated docs according to the selected framework.
Starlight
Section titled “Starlight”Source docs stay in src/content/docs, and translated docs go into locale folders under that directory:
src/content/docs/getting-started.mdxsrc/content/docs/es/getting-started.mdxsrc/content/docs/fr/getting-started.mdxVitePress and MkDocs
Section titled “VitePress and MkDocs”These use the same folder-per-locale convention inside the docs directory:
docs/guide.mddocs/es/guide.mddocs/fr/guide.mdDocusaurus
Section titled “Docusaurus”Docusaurus translations are written to its i18n docs structure:
docs/intro.mdxi18n/es/docusaurus-plugin-content-docs/current/intro.mdxi18n/fr/docusaurus-plugin-content-docs/current/intro.mdxNextra
Section titled “Nextra”Nextra writes translated files beside the source file using a locale suffix:
pages/docs/getting-started.mdxpages/docs/getting-started.es.mdxpages/docs/getting-started.fr.mdxStarlight example
Section titled “Starlight example”This repo uses Starlight, so a typical config looks like this:
{ "defaultLocale": "en", "locales": ["de", "es", "fr", "it", "ja", "ko", "pt", "ru", "zh"], "docs": { "framework": "starlight", "contentDir": "src/content/docs" }}Then run:
npx tyndale translate-docsTyndale reads the English docs from src/content/docs and writes translated docs into locale folders like src/content/docs/es/ and src/content/docs/fr/.
CLI options
Section titled “CLI options”npx tyndale translate-docs --content-dir docs --concurrency 4Current options are:
--content-dir <path>to override the docs source directory--concurrency <n>to control parallel translation sessions--forceto retranslate all docs
What gets validated
Section titled “What gets validated”After each translation, Tyndale checks the generated document before keeping it. At a high level, it ensures the result still looks like a valid doc file:
- frontmatter is still present and usable
- required metadata such as
titlestill exists - source import lines are preserved
- the model did not wrap the whole file in code fences
If a generated file fails validation, Tyndale asks the model to correct it and retries automatically. Files that still fail are reported at the end of the run.