ConstA CAS number (7647-01-0) or an English chemical name (hydrochloric acid)
Target language code, e.g. nl
The label first, then up to wikidata.maxAliases aliases; an empty array when
Wikidata has no confident match; undefined if the lookup failed
await getLocalizedNames("7647-01-0", "nl");
// Returns: ["zoutzuur"]
await getLocalizedNames("sodium chloride", "nl");
// Returns: ["natriumchloride"]
await getLocalizedNames("not a chemical", "nl");
// Returns: []
export const getLocalizedNames: (term: string, lang: string) => Promise<string[] | undefined> =
withTtlCache(getLocalizedNamesUncached, { namespace: 'wikidataNames', ttlMs: TTL_MS });
Resolves a CAS number or English chemical name to its Wikidata label and aliases in another language. Cached for
wikidata.ttlDays(config.json); a definitive "no match" is cached as an empty array, a failed request (undefined) is not.