Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Language Configuration

Each target language can have specific translation rules that are automatically included in Claude’s prompts. These rules handle language-specific typography, punctuation conventions, and stylistic guidelines.

Supported languages

CodeLanguageStatus
zh-cnChinese (Simplified)✅ Configured
faFarsi (Persian)✅ Configured
frFrench✅ Configured (draft glossary)
mlMalayalam✅ Configured (keep-English policy; glossary in review)
jaJapanese✅ Configured (glossary reviewed on #69, July–September 2026; house style ruled on #337, October 2026)
esSpanishPlanned

Current rules

Chinese (Simplified) — zh-cn

Farsi — fa

French — fr

The register and anti-calque rules encode the first native-editor review of machine output (August 2026); each generalises a correction made at least twice across the reviewed lectures.

Japanese — ja

The terminology rules encode the review of the glossary draft on PR #69 (July–September 2026): a whole-glossary pass by Chihiro2000GitHub with confirmations by sayaikegawa and xuanguang-li, and the policy rulings by jstac — Japanese where a standard term exists, English otherwise, if in doubt English. The house style — the register and parentheses rules, and the amended punctuation, spacing and dataset rules — follows the rulings on #337 (October 2026). Comments in code cells are translated into Japanese, and figure labels stay in English until Japanese font support lands (#260). Decision records D-2026-09-01-ja-terminology-policy and D-2026-10-22-ja-house-style.

How rules are applied

Language rules are appended to every translation prompt as numbered rules after the standard instructions. For example, when translating to zh-cn, Claude’s prompt includes:

CRITICAL RULES:
1. Preserve all MyST Markdown formatting...
2. DO NOT translate code, math, URLs...
...
9. Use proper full-width Chinese punctuation marks (,:。!?) not ASCII punctuation

Rules apply to all translation modes: UPDATE (incremental sync), NEW (full file), and RESYNC (drift recovery).

Supported languages

The GitHub Action validates target-language against its configured language list — currently en, zh-cn, fa, fr, ml, and ja — and fails immediately, before any work happens, on anything else. Adding a language means adding a LANGUAGE_CONFIGS entry in src/language-config.ts (a glossary alone does not enable a language); the drift test in language-config.test.ts keeps this page’s list in sync with the code.

The CLI (translate init, forward, backward) never validates the language code: any code works there, with no language-specific rules applied for unconfigured codes.

Malayalam — ml

Malayalam is keep-English-dominant, unlike every other configured language. Technical and domain terms stay in their original English/Latin form rather than being translated or transliterated; only the connective prose is Malayalam, with case-suffixes and sandhi attached to the English roots (economy-യിലെ, bond-ന്റെ, supply-യും). Section headings stay in English.

The reason is register, not convenience: Kerala has no Malayalam-medium STEM university or active classroom term bank, and learners meet these terms in English from first exposure — so translating them reads archaic rather than accessible. This is native-speaker guidance recorded in issue #70 and implemented in #71, and it inverts the full-translation pattern zh-cn and fa follow. The glossary’s role flips accordingly: rather than a technical dictionary, it is a small consistency list (77 terms) — mostly keep-English pins (ml == en) for the technical and instructional terms machine output most often over-translates or transliterates, plus a handful of reviewer-approved everyday-word translations.

The rule set has been extended three times from native-reviewer evidence, in the same pattern as French: the reviewer’s packet reply of 2026-08-03 (register and morphology confirmations, glossary v0.2.0); the first inline review round (August 2026), which added the below-deixis pattern (താഴെ കാണാം for “here is X” pointing at content below), discourse-formula and calque rules, ordinal and case-allomorph morphology, a classroom sentence-splitting register rule, glossary v0.3.0, and the ruling that exercise Hint/Solution sections which are predominantly mathematical reasoning stay wholly in English (decision record D-2026-08-17-ml-math-heavy-sections-stay-english); and the second inline round (September 2026), which added terminal punctuation (a colon before the cell or list a paragraph introduces), sentence-initial capitalisation of retained-English words, the hortative teacher’s voice (നമുക്ക് … -ആം, never നമ്മൾ … -ും), fixed renderings (“a given” → തന്നിരിക്കുന്ന, “consider” → നോക്കാം), the sandwich-sentence rule for prose interrupted by code cells, glossary v0.4.0, and the extension of the scope ruling to exercise statements with mathematical content (decision record D-2026-09-01-ml-exercise-statements-stay-english).

Adding a new language

To add rules for a new language, edit src/language-config.ts:

export const LANGUAGE_CONFIGS: Record<string, LanguageConfig> = {
  'zh-cn': { /* ... */ },
  'fa': { /* ... */ },

  // Add new language:
  'es': {
    code: 'es',
    name: 'Spanish',
    additionalRules: [
      'Use inverted punctuation marks (¿?) for questions and (¡!) for exclamations',
    ],
  },
};

Each language configuration has:

After adding a language configuration, you should also:

  1. Create a glossary file at glossary/{code}.json (see Glossary)

  2. Add test cases for the new language

  3. Rebuild the action (npm run build)