Skip to content

Move hardcoded error/status strings into i18n(错误信息走 i18n) #4

@Kaka-cheaper

Description

@Kaka-cheaper

Goal

Several status / error messages in the viewer are still hardcoded Chinese. Move them all into viewer/src/lib/i18n.ts so they switch with the language toggle.

Why

UI 99% goes through i18n already, but a handful of strings (mostly inside App.tsx's drag handlers and error fallback) escaped. Easy cleanup.

Scope (what is in)

  • Grep the viewer/src/ tree for Chinese characters in .tsx/.ts files (excluding example data and i18n.ts itself)
  • For each string, add a key in i18n.ts's messages.zh-CN and messages.en, replace the hardcoded string with t('that.key')

Out of scope

  • Translation polish (rough English is fine if you're not native)
  • AGENTS.md / CHANGELOG / docs (those are author content, not UI)

Files likely involved

  • viewer/src/App.tsx
  • viewer/src/app/ErrorBoundary.tsx
  • viewer/src/app/TopBar.tsx
  • viewer/src/lib/i18n.ts

Acceptance criteria

  • git grep -P '[\\u4e00-\\u9fff]' viewer/src/{**/*,*}.{ts,tsx} returns nothing (or only what's clearly data)
  • Switching language toggle updates all status / error texts
  • No regression in npm run build and lint

Estimated effort

~2-3 hours

Hints

useI18n hook is already there and used in many components. Existing keys like topbar.openButton, error.boundaryTitle are good naming examples.

Want to take this?

Comment "I'd like to take this" and I'll confirm within 24h.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersviewerViewer (frontend canvas, interaction, layout)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions