Skip to content

feat: add complete English and Simplified Chinese localization#247

Open
eachann1024 wants to merge 2 commits intodecolua:masterfrom
eachann1024:dev/i18n-next-intl-en-commit
Open

feat: add complete English and Simplified Chinese localization#247
eachann1024 wants to merge 2 commits intodecolua:masterfrom
eachann1024:dev/i18n-next-intl-en-commit

Conversation

@eachann1024
Copy link
Contributor

Summary

  • Add full bilingual support for English and Simplified Chinese across the 9Router web UI.
  • Integrate next-intl as the primary i18n runtime in App Router with locale-aware root layout wiring.
  • Add locale persistence via cookie (/api/locale) and a reusable language switcher in landing and dashboard shells.
  • Introduce complete message dictionaries for en and zh-CN under src/i18n/messages.
  • Backfill remaining legacy hardcoded UI strings through a shared literal translation layer so existing pages are fully switchable without URL changes.

Validation

  • npm run build
  • node /Users/eachann/Library/Mobile\ Documents/com~apple~CloudDocs/00000/LinkConfig/agents/skills/open-source-pr-guardrails/scripts/guardrail_check.mjs --phase repo --repo /Users/eachann/WorkMark/open-source/9router --fork-url https://github.com/eachann1024/9router.git --upstream-url https://github.com/decolua/9router.git --require-clean true
  • node /Users/eachann/Library/Mobile\ Documents/com~apple~CloudDocs/00000/LinkConfig/agents/skills/open-source-pr-guardrails/scripts/guardrail_check.mjs --phase commit --repo /Users/eachann/WorkMark/open-source/9router --mode range --base HEAD~1 --head HEAD --max-files 220 --max-top-level 4 --check-commit-messages true

- add bilingual support for dashboard and landing pages

- persist locale selection with cookie-based switching

- keep existing routes and API paths unchanged
decolua pushed a commit that referenced this pull request Mar 6, 2026
…se support

- Implement runtime i18n using MutationObserver for automatic DOM translation
- Add language switcher dropdown in dashboard header (EN/VI/ZH)
- Support 3 languages: English (default), Tiếng Việt, 简体中文
- Add translation files: vi.json (197 entries), zh-CN.json (513 entries, cleaned)
- Translate dashboard UI: sidebar menu, header, settings, MITM page
- Use cookie-based locale persistence with /api/locale endpoint
- Zero component changes required - translations applied at runtime
- Fix Header flicker on route change with key={pathname}

Co-authored-by: eachann <each1024@qq.com>
Based on PR #247 from decolua/9router with runtime approach

Made-with: Cursor
@decolua
Copy link
Owner

decolua commented Mar 6, 2026

Hi @eachann1024,

Thank you for your excellent work on PR #247! 🎉

I've integrated i18n support into the main branch, but with a different approach to minimize code changes:

What was implemented:

3 languages: English (default), Tiếng Việt, 简体中文
Language switcher dropdown in dashboard header
197 Vietnamese translations + 513 Chinese translations (cleaned from your PR)
Runtime i18n using MutationObserver - automatic DOM translation
Cookie-based locale persistence with /api/locale endpoint
Zero component changes - translations applied at runtime

Key differences from your PR:

  • Your approach: Modified 68 files with i18nText() wrapper calls
  • Our approach: Runtime DOM translation with MutationObserver
  • Benefit: No need to modify existing components, easier maintenance

Commit:

Your translation files (vi.json, zh-CN.json) were used as the foundation. Thank you for the comprehensive translation work! 🙏

The implementation is now live on master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants