Implementation:Alibaba ROLL I18n En Code
| Knowledge Sources | |
|---|---|
| Domains | Documentation, I18n |
| Last Updated | 2026-02-07 20:00 GMT |
Overview
English internationalization (i18n) translation file providing UI strings for the ROLL Docusaurus documentation website.
Description
code.json (English locale) is a JSON key-value translation file used by the Docusaurus i18n system to localize the ROLL documentation site into English. The file contains approximately 487 lines and maps translation keys to objects with a message field (the displayed English text) and an optional description field (contextual notes for translators). Keys follow Docusaurus theming conventions with dot-separated namespaces such as theme.blog.paginator.newerEntries and theme.docs.paginator.next.
The file includes translations for:
- Theme UI elements: error pages, back-to-top buttons, color mode toggles
- Blog navigation: pagination, archive titles, tag links
- Documentation navigation: breadcrumbs, version badges, pagination
- Site-specific strings: custom navigation labels like "Home", "Core Algorithms", "Research Community", "API Docs"
- Admonitions: caution, danger, info, note, tip labels
Usage
This file is consumed automatically by the Docusaurus build system when rendering the English version of the ROLL documentation site. Modify this file to:
- Update English UI string labels on the documentation site
- Add new translatable strings for custom Docusaurus components
- Keep English translations in sync after Docusaurus theme upgrades
Code Reference
Source Location
- Repository: Alibaba_ROLL
- File:
docs_roll/i18n/en/code.json
Data Schema / Signature
{
"<translation_key>": {
"message": "string -- The English translation text displayed to users",
"description": "string -- Optional context for translators (not displayed)"
}
}
Example entries:
{
"Home": {
"message": "Home"
},
"theme.docs.paginator.next": {
"message": "Next",
"description": "The label used to navigate to the next doc"
},
"theme.colorToggle.ariaLabel": {
"message": "Switch between dark and light mode (currently {mode})",
"description": "The ARIA label for the color mode toggle"
}
}
I/O Contract
Inputs
| Field | Type | Required | Description |
|---|---|---|---|
| translation_key | string (JSON key) | Yes | Dot-separated identifier following Docusaurus i18n naming conventions |
| message | string | Yes | The localized string value to display in the UI |
| description | string | No | 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 English locale site |
| Browser UI | Displays the translated strings in navigation, buttons, labels, and other UI elements |
Usage Examples
import json
# Load English i18n translations
with open("docs_roll/i18n/en/code.json", "r", encoding="utf-8") as f:
translations = json.load(f)
# Access a specific translation
next_label = translations["theme.docs.paginator.next"]["message"]
print(f"Next page label: {next_label}") # Output: "Next"
# List all custom (non-theme) translation keys
custom_keys = [k for k in translations if not k.startswith("theme.")]
print(f"Custom keys: {custom_keys}")
# Output: ['like a Reinforcement Learning Algorithm Developer', 'Home',
# 'Core Algorithms', 'Research Community', 'API Docs']