Skip to content

F182 B5: i18n sweep — records & export (History, Reports, Audit, Export) - #248

Merged
mforce merged 5 commits into
mainfrom
f182-i18n-b5-records
Jul 28, 2026
Merged

mforce merged 5 commits into
mainfrom
f182-i18n-b5-records

Conversation

@mforce

@mforce mforce commented Jul 28, 2026 •

Copy link
Copy Markdown
Owner

B5 — records & export. Sixth batch of the #182 string sweep. Externalizes the four records/export screens to the catalog, with es/tl (translate-now policy), plus the audit action/entity friendly-labelling.

Base main (B0–B4 all merged). i18n:scan on src/routes+src/components: 398 → 329. Coverage rose (a new ReportsPage test file replaces its 0%).

es/tl included (translate-now)

All four screen namespaces (history 53, reports 23, audit 11, export 27) ship machine-drafted Spanish + Tagalog and are in TRANSLATED_NAMESPACES — so Spanish/Tagalog mode renders translated on these pages. Plus the enums:auditAction.*/enums:entityType.* labels (below). All new es/tl marked // machine-drafted (#182) — pending native review; catalogParity enforces en/es/tl parity (placeholders {{time}}/{{count}}/{{status}} + <strong> tags verbatim). This drops the earlier English-first deferral for these screens (a separate PR backfills B1–B3).

Screens

  • HistoryPage → history (English-first). Entry-status pills (Draft/Submitted/Locked/ManagerAdjusted→"Adjusted"/Voided) kept in the history namespace — entry lifecycle is a distinct vocabulary from the shared enums status family, so it is NOT added to enums. history:lockedAt "Locked {{time}}" interpolation; StatusBadge status= stays raw, translated label= added.
  • ReportsPage → reports (English-first) + a NEW test file (this screen had 0% coverage). Counts via {{count}} interpolation (no plurals); admin-gated profit/expense section tested on both isAdmin branches. Global coverage rose (stmts 85.55→86.95, br 75.26→76.85, fn→80.64, ln→90.31).
  • AuditPage → friendly-labelled + translated (your call). Two NEW typed enum families in enums.ts — auditAction (28 codes) + entityType (13) — with human labels ("DailyEntry.Adjust" → "Daily entry adjusted"), compile-time exhaustive (a renamed value is a TS2741) with raw-value fallback for unlisted server codes. Labels translated es/tl (enums is a translated namespace — parity enforced). The local hardcoded actions array is replaced by AUDIT_ACTION_VALUES (single source of truth, part of the Tech debt: magic strings — duplicated role/claim constants, untyped SPA status strings #84 magic-strings debt). Audit page chrome → audit namespace (English-first). Filter option value= stays the raw code; option text + cells use the label helpers.
  • ExportPage → export (English-first). Dataset picker labels via a compile-checked dynamic t(\dataset.${d}`)over the client-definedEXPORT_DATASETSconst (identity values; a missing key is both aTS2345 and a runtime-test failure). **CSV headers/file contents are server-side (CsvExport.cs`) — untouched**; download mechanics + filenames unchanged.

Guarantees held

  • es/tl parity across en/es/tl for every namespace now in TRANSLATED_NAMESPACES (the 4 screen namespaces + the 41 enums:auditAction.*/enums:entityType.* label keys) — key sets equal, placeholders/tags verbatim, machine-drafted pending native review.
  • Formatting stays farm-locale-driven — zero i18n.language/Intl formatting in any screen; formatMoney untouched.
  • Enum families follow the existing typed-Record pattern and auto-register with the generic enums drift test.
  • Wiring proven per screen by the i18n.addResource override technique (each mutation-probed).

Testing / review

npm run test 997 green (incl. catalogParity for the 41 new enum keys); coverage above floors and rising; npm run typecheck clean; npm run build succeeds. Each screen individually reviewed (spec + quality, empirical probes); whole-branch review (opus comprehensive — READY-WITH-MINORS).

Follow-up filed

The whole-branch review surfaced a pre-existing audit-log gap (not introduced here): the server emits 31 audit action codes but the client list carries 28 — missing Account.SetLogo/RemoveLogo/UpdateSettings and the FarmLogo entityType (renders raw via fallback). B5 faithfully ported the prior 28-code list, so this is not a regression. Filed as #247 (tied to the #84 magic-strings debt) rather than scope-widening this port.

Not in scope

Native-speaker review of the machine-drafted es/tl (stays open on #182); the audit action-code reconciliation (#247); the B1–B3 es/tl catch-up (separate PR); B6 (Help — the final batch).

mforce added 4 commits July 27, 2026 18:28
Adds the English-first `history` namespace (53 keys) and wires every
render-context string through useTranslation("history")'s t(), every
imperative event-handler/mount-effect message through the i18n.t()
singleton, and the entry-status pills (Voided/ManagerAdjusted->Adjusted/
Locked incl. its {{time}}-interpolated tooltip/Submitted/Draft) as their
own bespoke history:status* vocabulary, distinct from enums:status per
the task brief. i18n:scan (src/routes src/components) drops from 398 to
366. es/tl catalogs and TRANSLATED_NAMESPACES are untouched.
Adds the `reports` namespace (English-only) to en.ts and wires
ReportsPage's production table, admin-gated money section, and prose
to useTranslation("reports")/<Trans>, reusing common:loading. Also
adds ReportsPage.test.tsx (0% coverage previously) covering render
data, the isAdmin fetch/render gate on both sides, and i18n wiring
including {{count}} interpolation and <Trans> component mapping.
…enums (#182)

Adds two new typed enum families to the shared enums module — auditAction
(28 capture-point codes) and entityType (13 values) — with es/tl
machine-drafted labels, and replaces AuditPage's hardcoded local action list
with the new AUDIT_ACTION_VALUES tuple. Externalizes the page chrome
(heading, filters, table headers, empty/loading state) into an
English-first `audit` namespace.
Task 30 (B5): new English-only `export` namespace (27 flat keys — 7
page-chrome strings plus one identity key per EXPORT_DATASETS member,
so the dataset picker's labels route through the catalog too). CSV
column headers/file contents stay server-side and untouched; download
filenames stay raw. es/tl unchanged (not in TRANSLATED_NAMESPACES).
Machine-drafts Spanish and Tagalog for the B5 screen namespaces
(History/Reports/Audit/Export) and adds them to TRANSLATED_NAMESPACES so
Spanish/Tagalog mode stops falling back to English on those pages.
catalogParity.test.ts enforces key/placeholder/tag parity; marked
pending native review, same convention as the prior settings/users/
expenses/customers backfill.
@mforce
mforce merged commit 2cf80c7 into main Jul 28, 2026
7 checks passed
@mforce
mforce deleted the f182-i18n-b5-records branch July 28, 2026 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant