02. i18n (English-first)
1. Policy
PI-Desktop is a global product.
- Default locale:
en - Source language: English
- Authoring language for specs/UI/source strings: English
- Other locales are translations of English sources
2. Framework requirements
UI must use i18next + react-i18next (D012).
Rules:
- No hard-coded user-facing English sentences scattered without IDs long-term
- Every visible string has a stable key
- Locale switch must not require code edits
- Every shipped locale has the same flattened key set as English
- Interpolation variable names and sets match across every locale
- Dates and times use the active application locale rather than the host default
- Electron application-menu custom labels and renderer window controls consume catalog keys; native role labels may use Electron/OS localization
3. Catalog structure
text
packages/i18n/src/locales/
├── en/index.ts
└── zh-CN/index.tsThe English catalog is the source type for translated catalogs. Catalog parity and interpolation parity are enforced by automated tests.
4. Key conventions
text
domain.section.itemExamples:
chat.composer.placeholdersettings.providers.addplugins.permissions.fs.write.workspaceerrors.tool.deniedcomposer.mode.agentcomposer.mode.planplan.approval.titleplan.approval.artifactPathplan.approval.openArtifactplan.approval.approveplan.approval.rejectplan.approval.permissionAutoWarningsettings.shell.defaultsettings.shell.unavailableerrors.COMMAND_SHELL_CHANGEDerrors.COMMAND_SHELL_INVALIDerrors.SHELL_NOT_FOUNDerrors.PLAN_ARTIFACT_WRITE_FAILEDerrors.PLAN_EXECUTION_INTERRUPTEDerrors.PLAN_REQUIRES_INTERACTIVE_SESSION
5. Non-UI language surfaces
Also English-first:
- docs/spec
- ADRs
- commit messages
- issue/PR templates
- plugin example docs
- command titles in core product
Plugins may include localized display fields later, but English fields are required.
6. Acceptance
- App boots in English by default
- Locale files exist for English source catalog
- Switching architecture supports additional locales
- No Chinese hard dependency in core UI path
- Catalog tests reject missing keys or mismatched interpolation variables
- Import, Projects, and Temporary sessions expose localized visible and accessible labels in English and Simplified Chinese
- macOS system-menu custom commands and Windows/Linux window controls expose localized English and Simplified Chinese labels
- Boot splash and renderer crash chrome use catalog keys (
app.starting,app.shellName,app.tagline,app.uiCrashed); empty-home hero titles are translated in every shipped locale - User-visible catalog copy prefers plain product language over internal engineering terms (
host/backend/repo refresh/workspacewhere the UI already says project). Status, empty states, errors, and setup hints explain what happened and what to do next (D149) - Agent/Plan/Goal selector, contract states, title/artifact-opener/ remembered approval-mode actions, Bash/Auto mutation warning, shell catalog/unavailable state, fail-closed recovery, and shared Plan/Goal error codes have matching English and zh-CN keys; no Chat operating-mode key or command is shipped