feat(species): locale-aware species labels via labelEn
B-6: SpeciesManifest only carried labelFr — EN users saw 'Cheval'. labelEn required on the manifest, speciesLabel(s, locale) helper in registry; AnimalForm dropdown + SvgEditor picker localized (locale passed into initSvgEditor, re-inits on locale change). Scaffolder template + ADDING-A-SPECIES.md + registry test updated.
This commit is contained in:
1 parent
74e1623135
commit
b047d352c1
8 files changed
+30
-12
No files matched your search
@@ -2,8 +2,9 @@ import type { Animal, Owner } from '@/domain/schema/animal'
|
||||
import Label from '@/components/ui/Label'
|
||||
import Input from '@/components/ui/Input'
|
||||
import Select from '@/components/ui/Select'
|
||||
import { getAllSpecies } from '@/domain/species/registry'
|
||||
import { getAllSpecies, speciesLabel } from '@/domain/species/registry'
|
||||
import { useT } from '@/i18n/useT'
|
||||
import { useLocaleStore } from '@/state/localeStore'
|
||||
|
||||
export interface AnimalFormProps {
|
||||
animal: Animal
|
||||
@@ -14,6 +15,7 @@ export interface AnimalFormProps {
|
||||
|
||||
export default function AnimalForm({ animal, owner, onChangeAnimal, onChangeOwner }: AnimalFormProps) {
|
||||
const t = useT()
|
||||
const locale = useLocaleStore((s) => s.locale)
|
||||
const species = getAllSpecies()
|
||||
const setA = (patch: Partial<Animal>) => onChangeAnimal({ ...animal, ...patch })
|
||||
return (
|
||||
@@ -29,7 +31,7 @@ export default function AnimalForm({ animal, owner, onChangeAnimal, onChangeOwne
|
||||
onChange={(e) => setA({ speciesId: e.target.value })}
|
||||
>
|
||||
{species.map((s) => (
|
||||
<option key={s.id} value={s.id}>{s.labelFr}</option>
|
||||
<option key={s.id} value={s.id}>{speciesLabel(s, locale)}</option>
|
||||
))}
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user