Internationalization

GemBook makes it easy to support multiple languages on the documentation site. The language code is displayed in the URL path: /{lang}/path. When accessing the website, if the path contains a language code, the language version will be displayed. If not, the most appropriate language will be selected according to the browser settings and redirected.

Enable internationalization

  1. Use --i18n to enable internationalization, which makes GemBook automatically redirect
  2. 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.md

For language code support, please check here.

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:

  • Modify the directory name, for example, change docs/zh/guide to docs/zh/002-指南
  • Add the file config.yml in the directory.