Internationalization (i18n)
This document describes how to add translations to Gasnet.org.
Current Status
Gasnet.org currently supports English only. Previous attempts to add Chinese translations (zh-CN) were incomplete and have been removed.
Adding a New Language
1. Update Docusaurus Config
Edit /docusaurus.config.js to add the new locale:
i18n: {
defaultLocale: 'en',
locales: ['en', 'zh-CN'], // Add your locale here
localeConfigs: {
en: { label: 'English' },
'zh-CN': { label: '简体中文' },
},
},
Add the locale dropdown to the navbar (only after translations exist):
navbar: {
items: [
// ... other items
{
type: 'localeDropdown',
position: 'right',
},
],
},
2. Create Translation Directory Structure
# Docusaurus will create this structure automatically
mkdir -p i18n/zh-CN/docusaurus-plugin-content-docs/current
3. Translate Documents
For each markdown file in docs/, create a corresponding translation:
docs/01-getting-started/intro.md
→ i18n/zh-CN/docusaurus-plugin-content-docs/current/01-getting-started/intro.md
4. Translate Theme Strings
Create i18n/zh-CN/docusaurus-theme-classic/navbar.json:
{
"title": {
"message": "Gasnet.org",
"description": "Navbar title"
},
"item.label.Docs": {
"message": "文档",
"description": "Navbar item label"
}
}
5. Extract and Translate
Use Docusaurus CLI to extract translatable strings:
npm run write-translations -- --locale zh-CN
Translation Workflow
- Only add a locale when translations are complete - Don't add empty/partial locales
- Translate all docs before enabling the dropdown - Incomplete translations create poor UX
- Use professional translation or native speakers - Technical HPC terminology requires precision
- Keep translations in sync - When updating English docs, update translations too
Supported Locales
| Locale | Label | Status |
|---|---|---|
en | English | ✅ Complete |
zh-CN | 简体中文 | Planned |
Resources
Loading comments...