From 602ea9c8e1b55261cf03e5232143a15650c289f6 Mon Sep 17 00:00:00 2001 From: Stan Runge Date: Sat, 24 Oct 2026 22:27:16 +0000 Subject: [PATCH] wildlife: fetch English names without the NL place (it localised them to Dutch) --- scripts/wildlife-import.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/wildlife-import.ts b/scripts/wildlife-import.ts index 9cd7d32..382a989 100644 --- a/scripts/wildlife-import.ts +++ b/scripts/wildlife-import.ts @@ -167,7 +167,8 @@ async function details(ids: number[], locale: 'en' | 'nl') { const out = new Map(); for (const [i, batch] of chunks(ids, 30).entries()) { const res = await inat<{ results: InatTaxon[] }>( - `/taxa/${batch.join(',')}?locale=${locale}&preferred_place_id=${PLACE_NL}` + // English names must not be localised to the NL place (that returns Dutch ones). + `/taxa/${batch.join(',')}?locale=${locale}${locale === 'nl' ? `&preferred_place_id=${PLACE_NL}` : ''}` ); for (const t of res.results) out.set(t.id, t); if (i % 20 === 0) log(` taxa (${locale}) ${Math.min((i + 1) * 30, ids.length)}/${ids.length}`); @@ -420,7 +421,7 @@ async function main() { nameNl = w.nl; if (!nameNl && w?.nl && w.nl.toLowerCase() !== t.name.toLowerCase()) nameNl = w.nl; if (nameNl) nameNl = nameNl.charAt(0).toUpperCase() + nameNl.slice(1); - const statuses = t.conservation_statuses ?? []; + const statuses = [...(tn?.conservation_statuses ?? []), ...(t.conservation_statuses ?? [])]; const global = statuses.find((s) => !s.place && s.authority === 'IUCN Red List'); let iucn = global?.iucn != null ? (IUCN_BY_NUMBER[global.iucn] ?? null) : null; if (!iucn && global?.status && /^(LC|NT|VU|EN|CR|EW|EX|DD)$/i.test(global.status))