This is the OpenIM documentation site built with Docusaurus. It supports two locales:
- zh-Hans (Chinese, default): Source files in
docs/ - en (English): Translated files in
i18n/en/
When asked to translate documentation, follow the rules below.
| Source (Chinese) | Target (English) |
|---|---|
docs/sdks/ |
i18n/en/docusaurus-plugin-content-docs-sdks/current/ |
docs/guides/ |
i18n/en/docusaurus-plugin-content-docs-guides/current/ |
docs/restapi/ |
i18n/en/docusaurus-plugin-content-docs-restapi/current/ |
docs/blog/ |
i18n/en/docusaurus-plugin-content-docs-blog/current/ |
-
Keep unchanged:
- All code blocks (
```) content - Frontmatter keys (only translate Chinese values like
title,description) - JSX/MDX component tags (
<Tabs>,<TabItem>, etc.) - Markdown link paths and URLs
- Variable names, function names, class names
- Import statements
- All code blocks (
-
Translate:
- All Chinese text content to natural English
- Table headers and cell content (Chinese → English)
- Section headings (e.g.,
## 功能介绍→## Description) - Inline comments in code examples (Chinese → English)
-
Common translations (keep consistent across all files):
- 功能介绍 → Description
- 返回原型 → Return Prototype
- 返回结果 → Return Results
- 调用示例 → Call Example
- 名称 → Name
- 类型 → Type
- 描述 → Description
Sidebar category labels for each docs plugin are translated in two places:
_category_.jsonfiles in the correspondingi18n/en/directorycurrent.jsonfiles ati18n/en/docusaurus-plugin-content-docs-*/current.json
For current.json:
- The key stays the same (may contain Chinese category name as identifier)
- Only the
messagefield should be translated to English - The
descriptionfield should also be updated to reflect the English label
Example:
{
"sidebar.tutorialSidebar.category.用户管理": {
"message": "User Management",
"description": "The label for category 'User Management' in sidebar 'tutorialSidebar'"
}
}If a new _category_.json is added in the source docs/ directory:
- Create the corresponding
_category_.jsonini18n/en/with translatedlabel - Run
npx docusaurus write-translations --locale ento regeneratecurrent.json - Translate any new Chinese entries in
current.json
After translating, verify:
- No Chinese characters remain in translated
messagevalues - Build succeeds:
pnpm build