Skip to content

Commit 1cef231

Browse files
Copilothuangyiirene
andcommitted
docs: Update README with language configuration documentation
- Document i18n configuration in docs.site.json - List all supported languages with translations - Explain how to add new languages - Update multi-language support features section Co-authored-by: huangyiirene <[email protected]>
1 parent 95a79d7 commit 1cef231

File tree

1 file changed

+41
-8
lines changed

1 file changed

+41
-8
lines changed

README.md

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ This repository contains the documentation for:
1313
## Features
1414

1515
- 🌍 **Multi-language Support**:
16-
- Source: English (`content/docs/*.mdx`)
17-
- Target: Chinese (`content/docs/*.cn.mdx`) - *Auto-translated via AI using dot parser*
16+
- Configurable via `docs.site.json`
17+
- Built-in support for: English, Chinese, Japanese, French, German, Spanish
18+
- Extensible: Easy to add new languages
19+
- Auto-translation via AI CLI using dot parser convention
1820
- 📝 **MDX Content**: Interactive documentation with Type-safe components.
1921
- 🛠️ **Automated Workflows**:
2022
- AI Translation CLI (`packages/cli`)
@@ -76,12 +78,43 @@ The guide covers:
7678

7779
### Internationalization (i18n)
7880

79-
The default language is configured in `lib/i18n.ts` as `en`. If you change the default language, you must also update the redirect destination in `vercel.json` to match (currently `/en/docs`).
81+
Language configuration is managed in `content/docs.site.json`:
82+
83+
```json
84+
{
85+
"i18n": {
86+
"enabled": true,
87+
"defaultLanguage": "en",
88+
"languages": ["en", "cn"]
89+
}
90+
}
91+
```
92+
93+
**Configurable Options:**
94+
- `enabled`: Enable/disable i18n support
95+
- `defaultLanguage`: The default language for the site (e.g., "en")
96+
- `languages`: Array of supported language codes (e.g., ["en", "cn", "ja", "fr"])
97+
98+
**Supported Languages:**
99+
The system includes built-in UI translations for:
100+
- `en` - English
101+
- `cn` - Chinese (Simplified) / 简体中文
102+
- `ja` - Japanese / 日本語
103+
- `fr` - French / Français
104+
- `de` - German / Deutsch
105+
- `es` - Spanish / Español
106+
107+
To add a new language:
108+
1. Add the language code to the `languages` array in `docs.site.json`
109+
2. If UI translations don't exist, add them to `packages/site/lib/translations.ts`
110+
3. Create content files with the language suffix (e.g., `file.{lang}.mdx`)
111+
112+
**Important:** If you change the default language, you must also update the redirect destination in `vercel.json` to match (currently `/en/docs`).
80113

81114
### Content Structure
82115

83-
Content files are located in `content/docs/` and use language suffixes:
84-
- `{filename}.en.mdx` - English content
85-
- `{filename}.cn.mdx` - Chinese content
86-
- `meta.en.json` - English navigation
87-
- `meta.cn.json` - Chinese navigation
116+
Content files are located in `content/docs/` and use language suffixes based on the `languages` configuration:
117+
- `{filename}.{lang}.mdx` - Language-specific content (e.g., `index.en.mdx`, `index.cn.mdx`)
118+
- `meta.{lang}.json` - Language-specific navigation (e.g., `meta.en.json`, `meta.cn.json`)
119+
120+
The CLI translate utility automatically generates language suffixes based on your configuration.

0 commit comments

Comments
 (0)