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
@@ -4,6 +4,7 @@ import { EQUINE_VERTEBRAL_FORMULA } from './vertebrae'
|
||||
const equine: SpeciesManifest = {
|
||||
id: 'equine',
|
||||
labelFr: 'Cheval',
|
||||
labelEn: 'Horse',
|
||||
mainSvg: '/species/equine/Horse.svg',
|
||||
details: {
|
||||
head: '/species/equine/Horse_head.svg',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { SpeciesManifest } from './types'
|
||||
import type { Locale } from '@/i18n/types'
|
||||
|
||||
/**
|
||||
* Auto-discovers every species manifest in `src/domain/species/*\/index.ts`
|
||||
@@ -49,3 +50,8 @@ export function getAllSpecies(): SpeciesManifest[] {
|
||||
a.labelFr.localeCompare(b.labelFr, 'fr'),
|
||||
)
|
||||
}
|
||||
|
||||
/** Display label of a species for the given locale. */
|
||||
export function speciesLabel(s: SpeciesManifest, locale: Locale): string {
|
||||
return locale === 'en' ? s.labelEn : s.labelFr
|
||||
}
|
||||
@@ -17,6 +17,8 @@ export interface SpeciesManifest {
|
||||
id: string
|
||||
/** Display name in French */
|
||||
labelFr: string
|
||||
/** Display name in English */
|
||||
labelEn: string
|
||||
/** Absolute public path to the main anatomy SVG */
|
||||
mainSvg: string
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user