Docusaurus has built-in internationalization (i18n) support that lets you ship your documentation in multiple languages. The system is decoupled from any specific translation service — you work with files on the filesystem and choose how to manage translation workflows. This guide covers locale configuration, the translation workflow, Crowdin integration, and deployment.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/facebook/docusaurus/llms.txt
Use this file to discover all available pages before exploring further.
i18n goals
The Docusaurus i18n system is designed to be:- Simple — put translated files at the correct filesystem location.
- Flexible — use Git, Crowdin, any FTP-based workflow, or SaaS translation tools.
- SEO-friendly — automatically sets
<html lang="...">andhreflanglink tags. - RTL-ready — Arabic, Hebrew, and other right-to-left locales are supported.
Configuring locales
Declare your default locale and all supported locales indocusaurus.config.js:
docusaurus.config.js
docusaurus.config.js
Translation file types
Docusaurus works with three kinds of translation files:Markdown files
Markdown files
Your doc and blog Markdown files are translated as whole files to preserve translation context. Copy your source files into the locale directory and translate them:
JSON files (Chrome i18n format)
JSON files (Chrome i18n format)
JSON files translate React code, navbar labels, footer labels, and sidebar category labels. The format uses Chrome i18n:
i18n/fr/code.json
Data files
Data files
Some plugins read external data files that need localized copies. For example, the blog’s
authors.yml can be localized at:Translation file structure
All translation data lives underwebsite/i18n/[locale]/[pluginName]/:
Translation workflow
Start the site in a locale
Run the development server for a specific locale:The site is accessible at
http://localhost:3000/fr/. Most labels will be untranslated until you provide translation files.Extract JSON translation keys
Run the This creates or updates JSON files under
write-translations command to extract all translatable strings from React code, theme config, and plugin options into JSON files:i18n/fr/. The command does static analysis of your source code — it cannot extract dynamically constructed strings.Translate Markdown files
Copy your source Markdown files to the locale directory and translate them in place:
Marking React strings for translation
In your custom React code and pages, wrap visible strings with the translation API:- Before
- After
src/pages/index.js
Crowdin integration
Crowdin is a translation SaaS with a free plan for open-source projects. It is used by Facebook to translate Docusaurus, Jest, and ReasonML documentation. The recommended Crowdin workflow:Set up the Crowdin project
Create a Crowdin project and generate an API token. Install the Crowdin CLI:
Configure crowdin.yml
Create a
crowdin.yml at your project root. Map source files to their translated locations:crowdin.yml
Crowdin is one option — the i18n system works with any tool that produces files at the expected filesystem paths. Teams also commonly use Git branches, forks, or submodules to manage translations collaboratively without a SaaS platform.
Deployment
Single-domain deployment
Build all locales together and serve them under one domain:build/— default locale (English)build/fr/— French locale
Multi-domain deployment
Build one locale at a time and deploy each to a different domain or subdomain:docusaurus.config.js to generate correct hreflang tags:
docusaurus.config.js