Repository navigation
Add i18n support to the UI (English + Simplified Chinese) - #290
zwanski-start wants to merge 1 commit into
Conversation
Introduce a lightweight, dependency-free i18n layer (ui/src/i18n) with
typed translation keys, {placeholder} interpolation, English fallback,
browser-language detection and a persisted language picker in Settings.
Translate the sidebar and Settings view into Simplified Chinese and
document how to add strings and languages.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🔍 QA report: ✅ PassedTester: Dennis (cubefarm agent, in a fresh session) · Round: 1 · Author: Ada The new i18n layer works: switching to 简体中文 in Settings → Appearance → Language immediately translates the sidebar and the whole Settings view, sets , saves the choice in localStorage and keeps it after a reload, and switching back restores English. UI lint (0 errors) and the type-checked build pass, and the browser console stayed clean. Browser-language matching works as documented: Simplified Chinese tags pick zh-CN and Traditional Chinese tags stay English. The 21 Python test failures are identical on master, and the e2e suite skipped itself here, so it gave no signal either way.
🧪 Commands run
No browser screenshots were taken in this round. Posted by cubefarm · merges automatically once GitHub's checks pass |
Closes #176
What changed
Adds i18n support to the React UI, with Simplified Chinese as the first translation.
ui/src/i18n/: a small i18n layer with no new dependencies.locales/en.tsis the source of truth.TranslationKeyis derived from it, sot('typo')fails the build.locales/zh-CN.tsis typed as the fullMessagesrecord, so a missing key also fails the build.t(key, { name })fills in{name}placeholders.tRich(key, { name: <code/> })does the same when a value is a React element.navigator.languages.zh,zh-CN,zh-SGandzh-Hans*map to Simplified Chinese; Traditional Chinese tags do not.localStorage(autoforge-locale).<html lang>is kept in sync.ui/src/i18n/README.md: how to uset(), add a string, and add a language.CLAUDE.mdgets a short pointer to it.<span>, so the inline<code>pieces no longer break onto separate grid rows.How I verified it
npm run lint: 0 errors. The 6 warnings were already there and none are in the new files.npm run build: type-check and Vite build pass.document.documentElement.langbecomeszh-CNand the choice is saved in localStorage.Assumptions / scope
t()in later PRs. The infrastructure is in place so contributors can do that bit by bit.react-i18nextto avoid new dependencies for a small catalog. Thet()API looks similar, so switching later would be mechanical.SettingsModal.tsxwas left untouched. It is no longer imported anywhere;SettingsViewreplaced it.🤖 Generated with Claude Code