|
1 | 1 | ---
|
2 |
| -title: "Translate" |
| 2 | +title: "Translate the Website" |
3 | 3 | weight: 100
|
4 |
| -draft: true |
| 4 | +draft: false |
| 5 | +summary: "Step-by-step instructions for translating lczero.org to new languages" |
5 | 6 | ---
|
6 | 7 |
|
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