Concepts
Internationalization
Create multi-language documentation with Docus v4 built-in i18n support.
Docus v4 introduces native internationalization support based on the @nuxtjs/i18n
module, allowing you to create documentation in multiple languages with automatic routing and content management.
Features
- Built-in i18n module: Native integration with
@nuxtjs/i18n
- Dynamic locale routing: Automatic URL prefixing with language codes (
/en/docs
,/fr/docs
) - Content collections per locale: Separate content management for each language
- Language switcher: Built-in component for switching between locales
Setup an existing project
To enable i18n in your Docus project, add the @nuxtjs/i18n
module to your nuxt.config.ts
and define your locales:
nuxt.config.ts
export default defineNuxtConfig({
modules: ['@nuxtjs/i18n'],
i18n: {
defaultLocale: 'en',
locales: [
{ code: 'en', name: 'English' },
{ code: 'fr', name: 'Français' },
],
}
})
Docus overrides the
@nuxtjs/i18n
strategy to prefix
.Create a new project with i18n template
When creating a new project, you can choose the i18n template for pre-configured internationalization:
Terminal
npx create-docus my-docs -t i18n
Directory Structure
When i18n is enabled, organize your content by locale in the content/
directory:
content/
├── en/ # English content
│ ├── index.md # English homepage
│ ├── getting-started/
│ │ ├── installation.md
│ │ └── configuration.md
│ └── guide/
│ └── advanced.md
├── fr/ # French content
│ ├── index.md # French homepage
│ ├── getting-started/
│ │ ├── installation.md
│ │ └── configuration.md
│ └── guide/
│ └── advanced.md
Each locale should mirror the same directory structure to maintain consistent navigation across languages.