feat: Add Traditional Chinese (zh-TW) i18n support#1
Open
sd0xdev wants to merge 1 commit intodelbaoliveira:mainfrom
Open
feat: Add Traditional Chinese (zh-TW) i18n support#1sd0xdev wants to merge 1 commit intodelbaoliveira:mainfrom
sd0xdev wants to merge 1 commit intodelbaoliveira:mainfrom
Conversation
- Establishes internationalization (i18n) support for English and Traditional Chinese (zh-TW) - Adds i18n foundation: strings.js with locale detection, translation helper, and template functions - Refactors UI/data flow to consume translated strings and localized content - Extends data models with zh-TW fields and updates core data (rooms/items/enemies/characters) with zh translations - Enables locale selection via URL query (?lang=zh-TW) and persists locale in progress data - Updates server/index flow to surface zh-TW option and logs - Introduces new zh-TW course content and accompanying lessons - Adds tests for i18n (detectLocale, t(), templates) and data integrity; includes server routing tests - Adds necessary dependencies and config (Anthropic SDK, dotenv, Vitest) and associated config/scripts - Improves READMEs and UI styling to support Chinese locale
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds full internationalization (i18n) infrastructure and Traditional Chinese (zh-TW) translation for the entire project — game UI, course lessons, and documentation.
strings.jswithdetectLocale(),t()dual-signature helper,T.*template functions, andlocalizeHTML()— locale detected via?lang=zh-TWURL parameter_zhsuffix fields in data JSON fileslearn-claude/zh-TW/, with lesson metadata (title_zh,file_zh) inlessons.json/course lang zh-TWcommand to switch course language, stored incourse-progress.json的naming style for items, monster language kept in original EnglishNoto Sans TC,PingFang TC,Microsoft JhengHei) with adjusted font sizes (14px base vs 10px pixel font) and antialiasing for Chrome/Safarireq.urlwith query string (e.g./?lang=zh-TW) caused 404 — fixed by stripping query params before file path resolution (affectsdungeon/,reference/complete/,reference/starter/)t()behavior,T.*templates, data file integrity (_zhfields),Sstring completeness,dirNames, and server query string routingpnpm startruns complete game (both languages),pnpm run devruns student workspaceFiles Changed
New Files
reference/complete/strings.jslearn-claude/zh-TW/*.md(11 files)README.zh-TW.mdtests/i18n.test.jstests/server.test.jsvitest.config.jspackage.jsonModified Files
reference/complete/game.jst()/T.*for all user-facing strings;take()/talk()match zh-TW namesreference/complete/ui/ui.jsreference/complete/style.cssreference/complete/index.htmlstrings.jsreference/complete/data/*.json_zhfields andiconfields to all data filesreference/complete/server.jsreference/starter/server.jsdungeon/server.js.claude/skills/course/SKILL.md.claude/skills/course/lessons.jsontitle_zh,file_zh,name_zhfieldsCLAUDE.mdREADME.mdpnpm start/pnpm run devscripts, language commandsi18n Architecture
Test Plan
pnpm test— 86 tests passhttp://localhost:3000— English UI renders correctlyhttp://localhost:3000?lang=zh-TW— Chinese UI renders with correct fonts/sizes/course lang zh-TWthen/course— dashboard shows Chinese lesson titlestake,talk,attackcommands work with Chinese item/NPC names