Skip to content

feat(i18n): add multi-language support for buddy reactions, achievements, and MCP responses - #108

Open
ndcorder wants to merge 1 commit into
ramarivera:mainfrom
ndcorder:feat/i18n-multi-language
Open

feat(i18n): add multi-language support for buddy reactions, achievements, and MCP responses#108
ndcorder wants to merge 1 commit into
ramarivera:mainfrom
ndcorder:feat/i18n-multi-language

Conversation

@ndcorder

@ndcorder ndcorder commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds multi-language (i18n) support for buddy reactions, achievements, and MCP response strings — closes [FEATURE] Add multi language support #16
  • Ships 18 locales: en (verified) + 17 AI-translated (zh, es, ja, de, fr, pt, ko, ru, ro, uk, tr, hi, it, pl, vi, ar, th)
  • Zero dependencies — custom JSON locale loader with fallback to English for missing keys

What changed

New files:

  • server/i18n.ts — zero-dep locale loader (t(), tArray(), tObj(), auto-discovers locale files)
  • locales/en.json — 2249-line English base with all Phase 1 strings
  • locales/*.json — 17 translated locales, each structurally validated
  • server/i18n.test.ts — 36 tests / 17,113 assertions validating all locales
  • scripts/translate*.ts — translation + audit tooling for adding new languages

Migrated files:

  • server/reactions.ts — all 100 reaction reasons, 18 species pools, stat overrides, escalation tiers, rarity flair now loaded from locale
  • server/achievements.ts — 130 achievement names/descriptions rendered via t()
  • server/index.ts — MCP response strings migrated, buddy_language tool added
  • server/state.tslanguage field added to BuddyConfig (default: "en")

CLI/skill updates:

  • cli/settings.tsbun run settings language <code>
  • skills/buddy/SKILL.md/buddy language [code] routing
  • cli/index.ts — help text updated
  • CONTRIBUTING.md — translation contribution guide
  • .gitignore / package.jsoni18n.lock ignored, locales/ in files array

How it works

  • Locale files live in locales/<code>.json, auto-discovered by scanning the directory
  • Each file has _language (display name) and _verified (boolean) metadata fields
  • setLocale(code) switches the active locale; t("key") looks up strings with English fallback
  • Users switch languages via /buddy language es or bun run settings language ja
  • The language picker shows "(AI-generated, unreviewed)" for non-verified locales

Translation quality

  • All 17 locales scored GOOD (4.4–5.0) in automated accuracy/tone/naturalness audit
  • 0% English fallbacks, 100% placeholder integrity across all locales
  • Translated with Claude Sonnet 4 + per-language style guides + few-shot examples
  • _verified: false on all AI locales — native speaker review sets it to true

How to test

bun test                    # 282 tests pass (246 existing + 36 new i18n)
bun run settings language   # show current language + available options
/buddy language es          # switch buddy to Spanish in Claude Code

Adding a new language: copy locales/en.json, translate values, drop it in locales/. No code changes needed.

@github-project-automation github-project-automation Bot moved this to Todo in Kanban Apr 24, 2026
@ndcorder
ndcorder marked this pull request as draft April 24, 2026 07:20
@ndcorder
ndcorder force-pushed the feat/i18n-multi-language branch 2 times, most recently from 0b4fea3 to 711b429 Compare April 25, 2026 18:48
@ndcorder

Copy link
Copy Markdown
Contributor Author

I am currently working on iterating the translation quality

Rebased onto upstream/main with expanded reaction/achievement set.

- server/i18n.ts: zero-dep locale loader with t()/tArray()/tObj()
- server/reactions.ts: all 100 reaction reasons migrated to locale
- server/achievements.ts: 130 achievement names/descriptions via t()
- server/index.ts: MCP response strings migrated, buddy_language tool added
- server/state.ts: language field in BuddyConfig (default: en)
- locales/en.json: 2249-line English base with all Phase 1 strings
- locales/*.json: 17 AI-translated locales (zh, es, ja, de, fr, pt, ko,
  ru, ro, uk, tr, hi, it, pl, vi, ar, th)
- cli/settings.ts: language setting with discovery
- skills/buddy/SKILL.md: language command routing
- server/i18n.test.ts: 36 structural integrity tests across all locales
- scripts/translate.ts: bulk translation tool for adding new locales

Signed-off-by: Nicolas Corder <ndcorder@pm.me>
@ndcorder
ndcorder force-pushed the feat/i18n-multi-language branch from 711b429 to 0b26b51 Compare April 25, 2026 20:43
@ndcorder
ndcorder marked this pull request as ready for review April 25, 2026 20:45
@ramarivera

Copy link
Copy Markdown
Owner

Hey @ndcorder — triaging the queue after the project's rename (claude-buddy → coding-buddy, native Pi / Oh My Pi extensions, npm publishing). Checking in on this one: it's the biggest open PR by far (17 locales, ~42k lines) and it now conflicts with main — and the gap widens with every merge, since reactions/achievements keep growing (38 new achievements landed since this was opened, plus the extension work).

Honest question before anyone invests more effort: are you still actively iterating on this? If yes, it probably makes sense to re-scope — land the string-extraction/i18n architecture first as a smaller PR, then locales incrementally, so the translation surface stops racing main. If life has moved on (totally fine), we'll close this and turn it into a roadmap issue crediting your groundwork so it isn't lost.

🤖 Created with the help of AI (Claude Fable 5).

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.

[FEATURE] Add multi language support

2 participants