Implementation:Alibaba ROLL I18n Zh Hans Code
| Knowledge Sources | |
|---|---|
| Domains | Documentation, I18n |
| Last Updated | 2026-02-07 20:00 GMT |
Overview
Chinese (Simplified) internationalization (i18n) translation file providing UI strings for the ROLL Docusaurus documentation website.
Description
code.json (zh-Hans locale) is a JSON key-value translation file used by the Docusaurus i18n system to localize the ROLL documentation site into Simplified Chinese. The file contains approximately 487 lines and maps the same translation keys as the English locale to Chinese-translated message values. Each entry is an object with a message field (the Chinese translation) and an optional description field (English context for translators).
The file covers all standard Docusaurus theme strings translated to Chinese, including:
- Theme UI elements: error pages ("页面已崩溃。"), back-to-top ("回到顶部"), color mode toggles ("浅色模式", "暗黑模式")
- Blog navigation: pagination ("较新的博文", "较旧的博文"), archive ("历史博文")
- Documentation navigation: breadcrumbs ("页面路径"), version badges ("版本:"), pagination ("上一页", "下一页")
- Editing and metadata: edit page links ("编辑此页"), last updated info ("最后...更新")
- Admonitions: caution ("警告"), danger ("危险"), info ("信息"), note ("备注"), tip ("提示")
Usage
This file is consumed automatically by the Docusaurus build system when rendering the Chinese (zh-Hans) version of the ROLL documentation site. Modify this file to:
- Update Chinese UI string labels on the documentation site
- Add new Chinese translations for custom Docusaurus components
- Maintain translation parity with the English locale file (
docs_roll/i18n/en/code.json)
Code Reference
Source Location
- Repository: Alibaba_ROLL
- File:
docs_roll/i18n/zh-Hans/code.json
Data Schema / Signature
{
"<translation_key>": {
"message": "string -- The Simplified Chinese translation text",
"description": "string -- Optional English context for translators (not displayed)"
}
}
Example entries:
{
"theme.docs.paginator.previous": {
"message": "上一页",
"description": "The label used to navigate to the previous doc"
},
"theme.colorToggle.ariaLabel": {
"message": "切换浅色/暗黑模式(当前为{mode})",
"description": "The ARIA label for the color mode toggle"
},
"theme.NotFound.title": {
"message": "找不到页面",
"description": "The title of the 404 page"
}
}
I/O Contract
Inputs
| Field | Type | Required | Description |
|---|---|---|---|
| translation_key | string (JSON key) | Yes | Dot-separated identifier following Docusaurus i18n naming conventions (same keys as English locale) |
| message | string | Yes | The Simplified Chinese localized string value to display in the UI |
| description | string | No | English context hint for translators explaining where/how the string is used |
Outputs
| Consumer | Description |
|---|---|
| Docusaurus build system | Reads JSON keys and renders message values in the zh-Hans locale site |
| Browser UI | Displays the Chinese translated strings in navigation, buttons, labels, and other UI elements |
Usage Examples
import json
# Load Chinese (Simplified) i18n translations
with open("docs_roll/i18n/zh-Hans/code.json", "r", encoding="utf-8") as f:
zh_translations = json.load(f)
# Access a specific Chinese translation
next_label = zh_translations["theme.docs.paginator.next"]["message"]
print(f"Next page label (zh): {next_label}") # Output: "下一页"
# Compare with English locale for translation coverage
with open("docs_roll/i18n/en/code.json", "r", encoding="utf-8") as f:
en_translations = json.load(f)
en_keys = set(en_translations.keys())
zh_keys = set(zh_translations.keys())
missing = en_keys - zh_keys
print(f"Missing Chinese translations: {len(missing)}")