Add translated content
After preparing the structure of your project for localization, add the translated content files to your language subfolders.
Before you begin
Make sure you have the following:
- The structure of your project prepared for localization. See Set up folder structure.
- Translated content files.
Add translated content files
To add a translated Markdown file or API description file to your project, place the files in their respective language subfolders inside the @l10n
folder.
The relative path from the language subfolder to the translated file must be the same as the relative path from the root of the project to the file in the default language. For example, if you originally had a file with path ./index.md
, the file translated to Spanish must be located in ./@l10n/es-ES/index.md
, as in the following example:
your-awesome-project ├── @l10n │ ├── es-ES │ │ ├── images │ │ ├── index.md │ │ └── openapi.yaml │ ├── es-419 │ │ ├── images │ │ ├── index.md │ │ └── openapi.yaml │ ├── fr │ │ ├── images │ │ ├── index.md │ │ └── openapi.yaml │ ├── ja │ │ ├── images │ │ ├── index.md │ │ └── openapi.yaml │ ├── zh-Hans │ │ ├── images │ │ ├── index.md │ │ └── openapi.yaml │ └── zh-Hant │ ├── images │ └── openapi.yaml │ ├── index.md ├── images ├── index.md ├── openapi.yaml └── redocly.yaml
Localize partial content
You can localize content you include in partials, or reusable content files pulled into multiple files using a partial
Markdoc tag.
To localize content in partials:
- Add a folder with the same name as your partials folder to each of your language subfolders.
- Place the translated content in each of the partials folders.
your-awesome-project ├── _partials ├── @l10n │ ├── es-ES │ │ ├── _partials │ │ ├── images │ │ ├── index.md │ │ └── openapi.yaml │ ... ├── images ├── index.md ├── openapi.yaml └── redocly.yaml
Resources
- Find the next steps to add localization to your project in Configure localization.
- Learn how to localize the UI labels in your project in Localize labels using translation keys.