- Nouveau bilan
-
- Démarrer un nouveau bilan d'ostéopathie sur un animal.
-
-
+ {t('home.new_report.title')}
+ {t('home.new_report.description')}
+
- Importer un PDF
-
- Reprendre un bilan précédent généré par cette application pour effectuer un suivi.
-
+ {t('home.import.title')}
+ {t('home.import.description')}
{error && {error}
}
diff --git a/src/app/routes/NewReportRoute.tsx b/src/app/routes/NewReportRoute.tsx
index 1c41cab7..7455015e 100644
--- a/src/app/routes/NewReportRoute.tsx
+++ b/src/app/routes/NewReportRoute.tsx
@@ -3,16 +3,19 @@ import { Link, useNavigate } from 'react-router-dom'
import PractitionerForm from '@/components/report/PractitionerForm'
import AnimalForm from '@/components/report/AnimalForm'
import Brand from '@/components/brand/Brand'
+import LanguageSwitcher from '@/components/brand/LanguageSwitcher'
import Button from '@/components/ui/Button'
import Input from '@/components/ui/Input'
import Label from '@/components/ui/Label'
import { todayIso } from '@/lib/dates'
import { readCachedPractitioner, writeCachedPractitioner } from '@/state/practitionerCache'
import { useReportStore } from '@/state/reportStore'
+import { useT } from '@/i18n/useT'
export default function NewReportRoute() {
const navigate = useNavigate()
const initReport = useReportStore((s) => s.initReport)
+ const t = useT()
const [practitioner, setPractitioner] = useState({ name: '' })
const [animal, setAnimal] = useState({ speciesId: 'equine', name: '' })
@@ -43,34 +46,32 @@ export default function NewReportRoute() {
return (
-
diff --git a/src/app/routes/NotFoundRoute.tsx b/src/app/routes/NotFoundRoute.tsx
index 851f794d..7367e553 100644
--- a/src/app/routes/NotFoundRoute.tsx
+++ b/src/app/routes/NotFoundRoute.tsx
@@ -1,14 +1,16 @@
import { useNavigate } from 'react-router-dom'
import Button from '@/components/ui/Button'
+import { useT } from '@/i18n/useT'
export default function NotFoundRoute() {
const navigate = useNavigate()
+ const t = useT()
return (
-
Page introuvable
-
Le chemin demandé n'existe pas.
-
+
{t('not_found.title')}
+
{t('not_found.description')}
+
)
diff --git a/src/components/brand/LanguageSwitcher.tsx b/src/components/brand/LanguageSwitcher.tsx
new file mode 100644
index 00000000..25325e1d
--- /dev/null
+++ b/src/components/brand/LanguageSwitcher.tsx
@@ -0,0 +1,40 @@
+import { useLocaleStore } from '@/state/localeStore'
+import type { Locale } from '@/i18n/types'
+
+const ITEMS: { value: Locale; label: string; ariaLabel: string }[] = [
+ { value: 'fr', label: 'FR', ariaLabel: 'Passer en français' },
+ { value: 'en', label: 'EN', ariaLabel: 'Switch to English' },
+]
+
+export default function LanguageSwitcher() {
+ const locale = useLocaleStore((s) => s.locale)
+ const setLocale = useLocaleStore((s) => s.setLocale)
+ return (
+
+ {ITEMS.map((item) => {
+ const active = locale === item.value
+ return (
+
+ )
+ })}
+
+ )
+}
diff --git a/src/components/observation/FindingsTreePicker.tsx b/src/components/observation/FindingsTreePicker.tsx
index d072e882..b66c951f 100644
--- a/src/components/observation/FindingsTreePicker.tsx
+++ b/src/components/observation/FindingsTreePicker.tsx
@@ -5,6 +5,8 @@ import type {
} from '@/domain/schema/findings'
import type { Finding } from '@/domain/schema/observation'
import Button from '@/components/ui/Button'
+import { useT } from '@/i18n/useT'
+import { useLocaleStore } from '@/state/localeStore'
export interface FindingsTreePickerProps {
zoneId: string
@@ -53,6 +55,13 @@ export default function FindingsTreePicker({
selected,
onChange,
}: FindingsTreePickerProps) {
+ const t = useT()
+ const locale = useLocaleStore((s) => s.locale)
+ const nameOf = (node: { name_fr: string; name_en: string }) =>
+ locale === 'en' ? node.name_en : node.name_fr
+ const descOf = (node: { description_fr?: string; description_en?: string }) =>
+ locale === 'en' ? node.description_en : node.description_fr
+
const [path, setPath] = useState
([])
const currentNodes = useMemo(() => {
@@ -67,19 +76,21 @@ export default function FindingsTreePicker({
)
const breadcrumb = useMemo<{ label: string; depth: number }[]>(() => {
+ const pick = (z: { name_fr: string; name_en: string }) =>
+ locale === 'en' ? z.name_en : z.name_fr
const crumbs: { label: string; depth: number }[] = [
- { label: tree.name_fr, depth: 0 },
+ { label: pick(tree), depth: 0 },
]
let nodes: FindingNode[] = tree.categories
path.forEach((seg, i) => {
const n = nodes.find((x) => x.id === seg)
if (n) {
- crumbs.push({ label: n.name_fr, depth: i + 1 })
+ crumbs.push({ label: pick(n), depth: i + 1 })
nodes = n.children ?? []
}
})
return crumbs
- }, [tree, path])
+ }, [tree, path, locale])
function isLeafSelected(leafPath: string[]): boolean {
return selected.some(
@@ -141,9 +152,9 @@ export default function FindingsTreePicker({
})}
- {focusedNode?.description_fr && (
+ {focusedNode && descOf(focusedNode) && (
- {focusedNode.description_fr}
+ {descOf(focusedNode)}
)}
@@ -152,22 +163,24 @@ export default function FindingsTreePicker({
size="sm"
variant="ghost"
onClick={() => setPath(path.slice(0, -1))}
- aria-label="Retour au niveau précédent"
+ aria-label={t('findings.back_to_parent')}
>
- ← Retour
+ {t('findings.back')}
)}