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:
Bastien Chanot committed 2026-07-12 16:23:07 +02:00
1 parent 74e1623135
commit b047d352c1
8 files changed
+30 -12

No files matched your search

+6 -3
View File
@@ -65,16 +65,17 @@ function capitalize(s) {
return s.charAt(0).toUpperCase() + s.slice(1)
}
function indexTs({ id, labelFr, mainSvgPath, details, formulaConstName }) {
function indexTs({ id, labelFr, labelEn, mainSvgPath, details, formulaConstName }) {
const detailLines = details
.map((d) => ` ${d.key}: '${d.path}',`)
.join('\n')
return `import type { SpeciesManifest } from '@/domain/species/types'
import { ${formulaConstName} } from './vertebrae'
export const ${id}: SpeciesManifest = {
const ${id}: SpeciesManifest = {
id: '${id}',
labelFr: '${labelFr.replace(/'/g, "\\'")}',
labelEn: '${labelEn.replace(/'/g, "\\'")}',
mainSvg: '${mainSvgPath}',
details: {
${detailLines}
@@ -83,6 +84,8 @@ ${detailLines}
findings: () => import('./pathologies'),
}
// Default export is the convention picked up by the registry's
// import.meta.glob() auto-discovery.
export default ${id}
`
}
@@ -184,7 +187,7 @@ async function main() {
const formulaConstName = `${id.replace(/-/g, '_').toUpperCase()}_VERTEBRAL_FORMULA`
const speciesDir = resolve(PROJECT_ROOT, 'src/domain/species', id)
const targets = {
'index.ts': indexTs({ id, labelFr, mainSvgPath, details, formulaConstName }),
'index.ts': indexTs({ id, labelFr, labelEn, mainSvgPath, details, formulaConstName }),
'vertebrae.ts': vertebraeTs({ formulaConstName, labelFr, formula }),
'pathologies.ts': pathologiesTs(),
'pathologies.json': pathologiesJsonTemplate({ id, labelFr, labelEn }),