Translate the Website
1. Configure the Language
- Open
config.toml
in the root directory - Locate the
[languages]
section - Add your language following the existing pattern:
[languages.xx] # Replace 'xx' with language code weight = 2 # Display order (1=English) languageName = "Language Name"
Language Codes Always use ISO 639-1 standards for language codes (e.g.,
es
for Spanish,fr
for French,de
for German).
2. Translate UI Strings
- Duplicate the English UI file: Copy
i18n/en.toml
and rename it using the language code for the new language. For example, for Spanish, you’d createi18n/es.toml
. - Translate all strings in the new file
3. Translate Content Pages
For each page you want to translate:
- Create a copy with the language code suffix:
original.md
tooriginal.[lang-code].md
(Example:troubleshoot.md
totroubleshoot.es.md
) - Open the new, language-specific file and translate:
- All front matter values (title, summary, etc.)
- Page content (Markdown text)
4. Mark Machine Translations (Optional)
If using automated translation tools, add to the page’s front matter:
machineTranslated: true
Important Considerations
Fallback Behavior If a specific page is not translated into a user’s selected language, the left sidebar will redirect to the English version.
Broken References Be mindful that internal links or cross-references within a translated page cannot refer to a default language page using a
<ref "relPageLink">
. It must refer to a translated version.
Translated Index Pages The top-level
_index.md
file within each main content section (e.g.,content/play/_index.md
,content/dev/_index.md
) must have a translated copy for every language enabled in that category. These index files define the section’s behavior and content listings for each language.