Localize Docusaurus pages with Translate wrapping, skeleton generation, and translation. Use when internationalizing Docusaurus. Triggers on "i18n", "多言語化", "翻訳追加", "localize page", "internationalize", "ページの多言語化".
Localize Docusaurus pages end-to-end: <Translate> / translate() wrapping, skeleton generation, translation, fastlane metadata consistency check, and build verification.
Core principle: Localize, don't translate. Each translation must read as if a native speaker wrote the web copy from scratch.
/docusaurus-i18n
/docusaurus-i18n src/pages/index.tsx
Specify a file to localize, or let the skill auto-discover pages.
At workflow start, create tasks for each phase:
TaskCreate: "Phase 0: Route — verify target is Docusaurus i18n"
TaskCreate: "Phase 1: Identify target strings"
TaskCreate: "Phase 2: Wrap with Translate"
TaskCreate: "Phase 3: Generate translation skeletons"
TaskCreate: "Phase 4: Translate"
TaskCreate: "Phase 5: Fastlane consistency check"
TaskCreate: "Phase 6: Build verification"
Update status as you progress: in_progress when starting, completed when done.
Verify the target is Docusaurus page localization.
Valid targets:
.tsx page/component files in a Docusaurus project (with docusaurus.config.* present)i18n/{locale}/code.json files for translation updatesRedirect:
**/metadata/**/subtitle.txt, keywords.txt, description.txt): Tell user "This looks like ASO metadata. Please use /aso-review instead." and STOP./lp-review instead." and STOP..xcstrings files detected: Tell user "For Swift localization, please use /swift-localization instead." and STOP.title, placeholder, alt, aria-label, etc.)<Translate> or translate()Add import if not present:
import Translate, { translate } from "@docusaurus/Translate";
Wrap JSX text with <Translate>:
<Translate id="page.section.element">English text</Translate>
Wrap string props with translate():
translate({ message: "English text", id: "page.section.element" })
Split complex JSX (with <strong>, <br/>, <a>, etc.) into segments
ID naming: {page}.{section}.{element} — lowercase, dot-separated
Reference: See references/_translate-patterns.md for detailed code patterns and pitfalls.
docusaurus.config.ts (i18n.locales)npx docusaurus write-translations --locale {locale}
i18n/{locale}/code.jsonLocalize, don't translate. See references/_localization-quality.md for per-language guidelines.
Before writing any translation, consider:
Good/Bad examples:
Hero headline "Get more done. Stress less.":
Feature description "Drag tasks around. Done ones disappear.":
i18n/{locale}/code.jsonIf fastlane/metadata/ exists, check consistency:
Compare terminology between web copy and App Store metadata per locale:
subtitle.txt — subtitlekeywords.txt — keywordsdescription.txt — descriptionCheck for:
Report inconsistencies with specific before/after suggestions
If significant metadata issues are found, suggest the user run /aso-review for a full metadata review
Skip this phase if no fastlane metadata directory exists.
Run build:
pnpm run build
Verify:
trailingSlash-related link issuesIf build fails: Fix the issue and re-build (max 3 attempts)
On success:
All locales built successfully.
- {file}: {N} strings wrapped, {M} locales translated
- Locales: ja, ko, zh-Hans, de, es, fr
On failure after max attempts:
Build failed after {N} attempts.
- {locale}: {error} — {suggested fix}
Bad (ja):
包括的なタスク管理ソリューションでワークフローを革新
Good (ja):
やることを、まとめて管理
Why: "包括的" and "ソリューション" are AI vocabulary. "革新" is inflated. The good version is natural and benefit-focused.
Bad (ko):
저희 서비스를 무료로 이용해 보시기 바랍니다
Good (ko):
무료로 시작하기
Why: The bad version has Japanese-style politeness norms (keigo leak). The good version is direct.
Bad (de):
Diese Funktion ermöglicht es Ihnen, Ihre Aufgaben effizient zu organisieren
Good (de):
Aufgaben sortieren — fertig ist fertig
Why: Sie form, "ermöglicht es Ihnen" is corporate. The good version uses du-implied casual tone.
Bad (zh-Hans):
您可以通过访问设置页面来自定义您的通知偏好设置
Good (zh-Hans):
打开设置,按你的习惯调整通知就好
Why: 您 is overly formal for consumer web. The good version is conversational.
write-translations should only ADD new keys| Error | Cause | Fix |
|---|---|---|
Untranslated string build warning | Missing translation in code.json | Add translation for the locale |
Broken link | trailingSlash or wrong relative path | Use absolute path or adjust ../ prefix |
Broken anchor | Non-ASCII heading without explicit anchor | Add {#english-anchor} to heading |
Module not found: @docusaurus/Translate | Missing import | Add import Translate, { translate } |
Duplicate id | Same Translate id used twice | Use unique IDs per {page}.{section}.{element} |
| File | Load When |
|---|---|
references/_translate-patterns.md | Auto-loaded: Translate/translate() code patterns and Docusaurus pitfalls |
references/_localization-quality.md | Auto-loaded: Per-language web copy translation quality guidelines |