Skip to content

Commit 2c66197

Browse files
committed
Update translate.md
1 parent 26ec8e7 commit 2c66197

File tree

2 files changed

+56
-25
lines changed

2 files changed

+56
-25
lines changed

config.toml

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,12 @@ defaultContentLanguageInSubdir = false
1616
disableDefaultLanguageRedirect = false
1717
enableMissingTranslationPlaceholders = true
1818
[languages]
19-
# [languages.de]
20-
# contentDir = 'content/de'
21-
# disabled = true
22-
# languageCode = 'de-DE'
23-
# languageDirection = 'ltr'
24-
# languageName = 'Deutsch'
25-
# title = 'Projekt Dokumentation'
26-
# weight = 2
27-
# [languages.de.params]
28-
# subtitle = 'Referenz, Tutorials und Erklärungen'
29-
30-
[languages.es]
31-
weight = 2
3219
[languages.en]
33-
# contentDir = 'content/en'
34-
# disabled = false
35-
# languageCode = 'en-US'
36-
# languageDirection = 'ltr'
37-
# languageName = 'English'
38-
# title = 'Project Documentation'
3920
weight = 1
40-
# [languages.en.params]
41-
# subtitle = 'Reference, Tutorials, and Explanations'
21+
[languages.es]
22+
weight = 2
23+
# [languages.de]
24+
# weight = 3
4225

4326
[[menu.main]]
4427
name = "Play"
Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,56 @@
11
---
2-
title: "Translate"
2+
title: "Translate the Website"
33
weight: 100
4-
draft: true
4+
draft: false
5+
summary: "Step-by-step instructions for translating lczero.org to new languages"
56
---
67

7-
It would be great to have popular pages (how to setup, bestnet etc) to be translated/written in other languages.
8-
TODO(Add instructions how to add translation).
8+
### 1. Configure the Language
9+
1. Open `config.toml` in the root directory
10+
2. Locate the `[languages]` section
11+
3. Add your language following the existing pattern:
12+
```toml
13+
[languages.xx] # Replace 'xx' with language code
14+
weight = 2 # Display order (1=English)
15+
languageName = "Language Name"
16+
```
17+
18+
> [!NOTE] Language Codes
19+
> Always use [ISO 639-1 standards](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) for
20+
language codes (e.g., `es` for Spanish, `fr` for French, `de` for German).
21+
22+
### 2. Translate UI Strings
23+
1. Duplicate the English UI file: Copy `i18n/en.toml` and rename it using the language code the new
24+
language. For example, for Spanish, you'd create `i18n/es.toml`.
25+
2. Translate all strings in the new file
26+
27+
28+
### 3. Translate Content Pages
29+
For each page you want to translate:
30+
1. Create a copy with the language code suffix:
31+
`original.md` to `original.[lang-code].md`
32+
(Example: `troubleshoot.md` to`troubleshoot.es.md`)
33+
2. Open the new, language-specific file and translate:
34+
- All front matter values (title, summary, etc.)
35+
- Page content (Markdown text)
36+
37+
### 4. Mark Machine Translations (Optional)
38+
If using automated translation tools, add to the page's front matter:
39+
```yaml
40+
machineTranslated: true
41+
```
42+
43+
### Important Considerations
44+
45+
> [!TIP] Fallback Behavior
46+
> If a specific page is not translated into a user's selected language, the left sidebar will
47+
redirect to the English version.
48+
49+
> [!CAUTION] Broken References
50+
> Be mindful that internal links or cross-references within a translated page cannot refer to a
51+
default language page using a `<ref "relPageLink">`. It must refer to a translated version.
52+
53+
> [!IMPORTANT] Translated Index Pages
54+
> The top-level `_index.md` file within each main content section (e.g., `content/play/_index.md`,
55+
`content/dev/_index.md`) **must** have a translated copy for every language enabled in that
56+
category. These index files define the section's behavior and content listings for each language.

0 commit comments

Comments
 (0)