Internationalization
GemBook makes it easy to support multiple languages on the documentation site. The language code is displayed in the URL path: /{lang}/path.
Paths without a language code (e.g. / or old links) redirect to the language preferred by the browser, or the default language.
Enable internationalization
- Use
or--i18n to enable internationalizationi18n - Move the document to a folder named with the language code, for example:
docs/
├── en
│ ├── guide
│ │ ├── README.md
│ │ └── installation.md
│ ├── 003-about.md
│ └── README.md
└── zh
├── guide
│ ├── README.md
│ └── installation.md
└── README.mdThe default language is en, or the first language if there is no en, use fallbackLanguage
For language code support, please check here. The text of the website itself (e.g. "Edit this page") supports English and Chinese, other languages use English.
Untranslated documents
A document that only contains a title (frontmatter and # Title) is untranslated, the document of the same path in the default language is machine translated when building and a notice is displayed; if the translation fails, the original document is displayed.
Directory name localization
By default, the directory name will be rendered directly in the sidebar. If you need to localize the directory name, there are two ways:
