Skip to content

feat: localized instrument catalogs - #1

Merged
gierschv merged 1 commit into
masterfrom
feat/localized-instrument-names
Jun 30, 2026
Merged

feat: localized instrument catalogs#1
gierschv merged 1 commit into
masterfrom
feat/localized-instrument-names

Conversation

@gierschv

Copy link
Copy Markdown
Member

What

Adds localized instrument names to the public catalog. Every non-English locale ships as a complete, drop-in catalog under data/i18n/<lang>.json — 27 locales.

Each locale file has the exact same shape and instrument IDs (same order) as data/instruments.json; only name/shortname (and group names) are localized, falling back to English wherever no translation exists. Consumers load the single file for their locale — nothing to merge.

import type { InstrumentsFile } from '@flat/instruments';
import fr from '@flat/instruments/data/i18n/fr.json' with { type: 'json' };

(fr as InstrumentsFile).groups
  .flatMap(g => g.instruments)
  .find(i => i.id === 'brass.trumpet'); // → { …, name: "Trompette", shortname: "Tromp." }

Changes

  • data/i18n/*.json — 27 localized catalogs (da, de, en-GB, es, fi, fil, fr, fr-CA, hi, id, it, ja, ja-HIRA, ko, ms, nb, nl, pl, pt, pt-BR, ro, ru, sv, tr, zh-Hans, zh-HK, zh-TW).
  • package.json — expose ./data/i18n/*.json via the exports map.
  • scripts/validate.mjs — validate every locale catalog against the JSON Schema and assert it exposes the same instrument IDs, in the same order, as the English catalog.
  • README.md — document localized usage.
  • test/i18n.test.mjs — structural-parity + real-translation tests.

The English data/instruments.json and the runtime JS API are unchanged.

Source

These files are generated from instruments-meta's localized fixtures via its sync-public-instruments script (separate GitLab change). To regenerate: pnpm sync-public from instruments-meta.

Verification

  • pnpm validate205 instruments / 11 groups, plus 27 localized catalogs
  • pnpm test → 12 passed

Add per-locale catalogs under data/i18n/<lang>.json (27 locales). Each is a
complete, drop-in catalog with the same shape and instrument IDs as
data/instruments.json, with localized name/shortname (falling back to English
where untranslated).

- expose ./data/i18n/*.json via package exports
- validate every locale catalog against the schema and assert ID/order parity
  with the English catalog
- document localized usage in the README and add locale catalog tests

Generated by instruments-meta's sync-public-instruments script.
@gierschv
gierschv merged commit fcef05b into master Jun 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant