feat(i18n): migrate site + PDF to locale-aware rendering
- formatDate(iso, locale) replaces formatDateFr in src/lib/dates.ts
- exportReportToPdf(report, { locale }) takes explicit locale option
- LanguageSwitcher segmented FR | EN toggle added; integrated in
ReportHeader, HomeRoute, NewReportRoute
- All routes (Home, NewReport, Editor, NotFound) + observation
components (FindingsTreePicker, ObservationCard, FreeTextFindingInput,
SeveritySelector, VertebraPicker, ObservationList) + report forms
(PractitionerForm, AnimalForm, ConclusionPanel, NextAppointmentPicker)
route hardcoded FR via useT()
- PDF render functions (export.ts, header.ts, footer.ts,
observationPage.ts, conclusionPage.ts) take a locale arg and read
static labels from the dict snapshot at call time
- Catalog finding leaf labels rendered via labelFr/EnSnapshot per locale
- description_fr / scope_disclaimer stay FR-only (out of scope —
vet-expert authoring needed for EN copy)
- LanguageSwitcher unit test (2) + lib.dates locale tests (7) cover
the new behavior
151/151 tests pass, lint 0, typecheck clean, vite build OK
(902KB main + 15KB lazy pathologies chunk).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
1 parent
359104ce88
commit
d6027266bc
25 files changed
+390
-207
No files matched your search
@@ -2,6 +2,7 @@ import { useState } from 'react'
|
||||
import Input from '@/components/ui/Input'
|
||||
import Button from '@/components/ui/Button'
|
||||
import Badge from '@/components/ui/Badge'
|
||||
import { useT } from '@/i18n/useT'
|
||||
|
||||
export interface FreeTextFindingInputProps {
|
||||
items: string[]
|
||||
@@ -13,6 +14,7 @@ export default function FreeTextFindingInput({
|
||||
onChange,
|
||||
}: FreeTextFindingInputProps) {
|
||||
const [v, setV] = useState('')
|
||||
const t = useT()
|
||||
|
||||
function add() {
|
||||
const trimmed = v.trim()
|
||||
@@ -31,17 +33,17 @@ export default function FreeTextFindingInput({
|
||||
<Input
|
||||
value={v}
|
||||
onChange={(e) => setV(e.target.value)}
|
||||
placeholder="Observation additionnelle (texte libre)"
|
||||
placeholder={t('observation.free_placeholder')}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault()
|
||||
add()
|
||||
}
|
||||
}}
|
||||
aria-label="Observation libre"
|
||||
aria-label={t('observation.free_aria')}
|
||||
/>
|
||||
<Button onClick={add} variant="secondary">
|
||||
Ajouter
|
||||
{t('common.add')}
|
||||
</Button>
|
||||
</div>
|
||||
{items.length > 0 && (
|
||||
@@ -52,7 +54,7 @@ export default function FreeTextFindingInput({
|
||||
{it}
|
||||
<button
|
||||
type="button"
|
||||
aria-label={`Retirer ${it}`}
|
||||
aria-label={`${t('observation.remove_zone')} ${it}`}
|
||||
onClick={() => remove(i)}
|
||||
className="ml-1 text-[var(--color-accent-strong)] hover:text-[var(--color-danger)]"
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user