UI-SPEC §4 has specified *Legal & About* since the spec was written, as a section inside Settings, and four milestones shipped without it. That is what folding a read-only surface into a screen of controls does. It is now the ninth tab. **The ninth tab cost nothing.** `App.tsx` reads `NAV_KEYS[key - 1]`, so appending `about` made it Ctrl+9 without moving one existing binding. UI-SPEC's warning was about *inserting* — which is still true, and is still why Snapshots is a mode of Environments: it would have to sit beside Environments to read as related. The comments in four files said "a ninth entry would renumber Ctrl+1..8"; they now say what the rule actually is. Contents: what PipDock does and what it does not collect; version and the legal-docs hash from `app_info` — a command that has existed since M1 with no consumer, so the version on screen cannot drift from CARGO_PKG_VERSION; the SPDX identifier `GPL-3.0-only` rather than the looser "GPL-3.0" elsewhere; a control that puts the gate back; and contact. **Addresses are copied, not opened.** `mailto:` would widen the opener capability by a whole URL scheme, and the scope's real job is bounding the two call sites that pass data — one of which hands over a URL that came out of ruff's JSON. Clipboard-write is already granted, works with no mail client, and the address has to be on screen anyway. Only `https://poli0981.dev/*` was added, for the links page. They are also TS constants rather than catalog entries: an address is data (I18N §2), and a catalog is a thing a translator is invited to change. **`review` is a flag of its own, not `accepted = false`.** Re-using the latter was one line and would have made a review indistinguishable from a revocation — offering Accept, and a Decline that closes the application, to someone who wanted to re-read their privacy policy. The gate takes a presentational prop instead; first-run rendering is untouched and `PdLegalGate.test.tsx` (its first test, ever) pins that. Two things found by running rather than by the suite: - `app_info` fired **twice** per mount under `npm run dev`. StrictMode's doubling is dev-only, but it drew attention to the real one: `key={nav}` remounts `<main>`, so every visit to About was a fresh call for a value baked in at compile time. Now cached per process in `useAppInfo`. Verified against the bridge log: one call. - The whole seam — About, re-open, Ctrl+3 refused behind the modal, Close, back on About — with zero IPC calls, confirming consent is never touched. VI catalog complete and checked in the running app; the parity gate gets the rest. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
4.1 KiB
PipDock — Internationalization (EN + VI)
Version 0.1 · 2026-07-17 · Scope decision: EN + VI in v1; JP is P2-6.
1. Mechanics
-
GUI: i18next + react-i18next; catalogs at
ui/src/locales/{en,vi}/{common,errors}.json.enis the source of truth;ui/src/i18n.test.tsfails the build ifviis missing keys, and untranslated keys fall back to EN at runtime with a console warning, never raw key names in the UI.Two files, one namespace — amended in S7. This section originally named seven namespaces. The app merges its catalogs into a single
commonat init, because a real second namespace meanst('errors:PD-NET-001')at every call site (i18next'snsSeparatoris:) — churn across every screen, bought with lazy loading a desktop app that bundles both catalogs cannot use. The error codes still get their own file, and that part earns itself: there are 34 of them, they are the only keys whose names are a contract with Rust rather than with a screen, and the test checks them against a generated copy ofCode::ALLrather than against a list someone maintains by hand. -
Core: Rust emits codes and structured data only (catalog codes, counts, package names); all human phrasing happens in the frontend catalogs. This keeps CLI (English-only v1) and GUI consistent without duplicating strings in Rust.
-
No hardcoded strings rule: enforced by an eslint rule on JSX literals (allowlist:
PipDock, package names, versions, codes). -
Interpolation via ICU-style placeholders:
"updateSummary": "{{ok}} successful, {{failed}} failed"/"{{ok}} thành công, {{failed}} thất bại". Plurals: use i18next plural forms; note Vietnamese has a single plural form — never build strings by concatenatings.
2. Locale behavior
Default locale = OS UI language if vi, else en; switchable in Settings, applied live. Dates via Intl.DateTimeFormat with the active locale; file sizes binary (MiB) with locale decimal separators. Package names, versions, engine output, error codes, email addresses, URLs and SPDX identifiers are never translated or reshaped.
The last three live as TypeScript constants beside the component that renders them, not in the catalogs — a catalog entry is a thing a translator is invited to change, and an address they changed would route mail nowhere. They reach JSX as expressions, which is also what keeps the pipdock/no-jsx-literals rule (§1) correct about them: it examines JSX text and string literals inside expression containers, never an identifier. PdAbout's CONTACT, PdSettings's engine ids and PdEmptyState's glyph are the same escape hatch used for the same reason.
3. Glossary (consistency contract)
| EN | VI | Note |
|---|---|---|
| environment | môi trường | |
| package | gói | not "thư viện" in UI copy (broader than libraries) |
| update / upgrade | cập nhật | one term for both in UI |
| held back | bị giữ lại | conflict preview |
| pin / pinned | ghim / đã ghim | |
| snapshot / rollback | ảnh chụp / khôi phục | "khôi phục" for the action |
| uninstall | gỡ cài đặt | |
| dependency | phụ thuộc | |
| force latest | ép bản mới nhất | keep the "ép" bluntness — it should sound risky |
| dry run / preview | xem trước | user-facing term is always "xem trước" |
| queue ("dock bay") | hàng chờ | dock-bay flavor stays EN-only in code names |
4. Copy rules
- Vietnamese copy uses "bạn", concise and direct; avoid literal translations of English idioms.
- Warning copy must not soften risk in translation — "this will break X" ⇒ "thao tác này sẽ làm hỏng X".
- Legal gate summaries are localized, but the linked legal documents themselves are EN (governing) with a VI courtesy note at top of each (see legal/ files).
- Error one-liners ≤ 90 chars in both languages (fit the inline row) — asserted, not aspired to, over every
Code::ALLvariant in both locales.
5. QA
Pseudo-locale build target (en-XA-style bracketed expansion) to catch clipping; VI sweep of all mutation dialogs is part of the manual release charter (TESTING §4); screenshots in both locales attached to release PRs for the three core screens.