chore(memory+docs): /ship-feature B3 capitalize — BDR-014/015 + LRN-017..019 + EVAL-002 + journal + TODO

Memory registry capitalization after B3 i18n FR/EN ship.

- decisions.md  +BDR-014 (PDF locale = render preference, store-driven, not Report schema field — dual label snapshot already carried).
- decisions.md  +BDR-015 (typed ImportError discriminant kind + foundVersion; UI resolves message via dict; review caught hardcoded FR in domain layer).
- learnings.md  +LRN-017 (i18n dict parity test: Object.keys().sort() equality + non-empty value assertion — cheapest drift guard).
- learnings.md  +LRN-018 (useT hook pattern: selector subscribe + dict closure-per-render, no prop drilling, missing-key dev-warn + key-literal fallback).
- learnings.md  +LRN-019 (exhaustive-deps trap when closures over store values appear inside useMemo deps — inline or useCallback).
- evals.md      +EVAL-002 (B3 review caught critical FR leak in pdf/import.ts + attachment.ts that grep+analyzer both missed — i18n migrations must enumerate ALL string-emitting files including error paths).
- journal.md    session 3 entry under 2026-05-20.
- TODO.md       B3 subsection rewritten as DONE with checked checkboxes + cross-refs.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Bastien ChanotandClaude Opus 4.7 committed 2026-05-20 07:43:11 +02:00
1 parent 9916c42484
commit 31bd82de58
7 files changed
+111 -21

No files matched your search

+9 -13
View File
@@ -61,20 +61,16 @@ with a French-language message.
- [x] `PathologyPicker` + `FreeTextPathologyInput` + their tests deleted; `FreeTextFindingInput` renamed equivalent kept
- [x] `tests/unit/components.FindingsTreePicker.test.tsx` covers navigation, leaf select, vet-referral flag, retour, deselect
### B3. i18n FR/EN — site + PDF
### B3. i18n FR/EN — site + PDF (DONE 2026-05-20)
- [ ] **Locale state**: `src/state/localeStore.ts` Zustand: `'fr' | 'en'`,
persisted in localStorage `osteo:locale`
- [ ] **i18n strings**: `src/i18n/{fr,en}.ts` — UI strings dictionary
- Migrate hardcoded French labels in components (buttons, headers, placeholders, toasts)
- Helper hook `useT()` returning `(key: string) => string`
- [ ] **Language switcher**: small FR/EN toggle in ReportHeader (next to Brand)
- [ ] **Findings rendering**: components pick `name_fr`/`name_en` based on current locale
- [ ] **PDF render**: `exportReportToPdf(report, { locale })` parameter
- All static PDF labels (eyebrow, section names) read from i18n dict
- Findings rendered via `labelFrSnapshot`/`labelEnSnapshot` depending on locale at export
- Date formatting locale-aware (`formatDateFr` → `formatDate(date, locale)`)
- [ ] **Tests**: locale switch updates labels; PDF roundtrip preserves locale snapshot
- [x] **Locale state**: `src/state/localeStore.ts` Zustand `'fr' | 'en'`, persisted `osteo:locale`
- [x] **i18n dicts**: `src/i18n/{fr,en}.ts` (~90 keys each, parity-tested), `index.ts`, `useT.ts` hook
- [x] **Language switcher**: `src/components/brand/LanguageSwitcher.tsx` segmented FR | EN toggle, integrated in ReportHeader + HomeRoute + NewReportRoute headers
- [x] **Findings rendering**: FindingsTreePicker + ObservationCard read `name_fr`/`name_en` per locale; finding snapshots already dual (BDR-010)
- [x] **PDF render**: `exportReportToPdf(report, { locale })` explicit option; static labels via dict snapshot; `formatDate(iso, locale)` replaces `formatDateFr`; finding leaf labels via `labelFr/EnSnapshot`
- [x] **PDF import error i18n**: typed ImportError(kind + foundVersion); UI resolves message via dict (BDR-015) — caught by review (EVAL-002)
- [x] **Out of scope (per design)**: `description_fr` + `scope_disclaimer` stay FR-only — vet-expert authoring needed for EN copy
- [x] **Tests**: localeStore (3), useT (3), dict parity (2), LanguageSwitcher (2), formatDate FR+EN (7), PDF roundtrip per locale (3). 154/154 green.
### B4. PDF observationPage updates