Skip to content

Update language data to langtags.json API 1.4 (BL-15916) - #149

Merged
hatton merged 4 commits into
mainfrom
BL-15916-update-language-data
Jul 27, 2026
Merged

Update language data to langtags.json API 1.4 (BL-15916)#149
hatton merged 4 commits into
mainfrom
BL-15916-update-language-data

Conversation

@andrew-polk

@andrew-polk andrew-polk commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Updates the language database to the latest source data and handles a breaking change in the new langtags.json format.

What changed

  1. Update language data to langtags.json API 1.4 (fix)

    • langtags.json: API 1.3.1 (2025-06-16) → API 1.4 (2026-06-09)
    • iso-639-3.tab: latest ISO 639-3 code table (renames + new codes)
    • iso-639-3-macrolanguages.tab: re-downloaded (content unchanged)
    • As of API 1.4, most region-specific entries (en-GB, de-AT, the ar-Arab-* set) no longer carry the iso639_3 field. The old pipeline skipped those entries entirely, which dropped the bulk of each language's regions and alternative tags (English regions 99 → 4, French 28 → 1, Arabic 27 → 3). langtagProcessing.ts now derives iso639_3 from the language subtag when the field is absent, so those entries consolidate into their language as before and the rest of the pipeline (including macrolanguage handling) treats them normally.
    • Regenerated languageData.json and equivalentTags.json.
    • Updated two data-sensitive test assertions that reflected values changed upstream in API 1.4 (aoc's former autonym "Kamarakotos" was removed; caa now ranks above xco for "cho" because its autonym changed).
  2. Add coverage for wsg/gon and arb/ara macrolanguage handling (chore, per Noel's note on the card)

    • Covers a simple representative pair (arb/ara) and a multi-member macrolanguage (gon → gno/wsg/esg), including that wsg absorbs the retired ggo code.
  3. Separate raw source data from processed data files (chore, per the card)

    • Raw source files moved into language-data/source/; the runtime-imported generated files stay in language-data/. Updated script paths and the README.

Verification

  • tsc typecheck: clean.
  • Full find-language test suite (vitest run): 174/174 pass.
  • Re-running the pipeline from the new source folder produces byte-identical generated output.
  • Remaining pipeline console warnings are all the documented known macrolanguage anomalies (nor, san, hbs, zap).

Ref: https://issues.bloomlibrary.org/youtrack/issue/BL-15916


This change is Reviewable

andrew-polk and others added 3 commits July 22, 2026 15:19
https://issues.bloomlibrary.org/youtrack/issue/BL-15916

Update the source data files to the latest releases:
- langtags.json: API 1.3.1 (2025-06-16) -> API 1.4 (2026-06-09)
- iso-639-3.tab: latest ISO 639-3 code table (renames + new codes)
- iso-639-3-macrolanguages.tab: re-downloaded (content unchanged)

As of langtags.json API 1.4, most region-specific entries (e.g. en-GB,
de-AT, the ar-Arab-* set) no longer carry the iso639_3 field. Without it,
langtagProcessing.ts was skipping these entries entirely, which dropped the
bulk of each language's regions and alternative tags (e.g. English regions
99 -> 4, French 28 -> 1). langtagProcessing.ts now derives the iso639_3 code
from the language subtag when the field is absent, so those entries
consolidate into their language as before; the rest of the pipeline
(including macrolanguage handling) then treats them like any normal entry.

Regenerated languageData.json and equivalentTags.json from the new data.

Also updated two data-sensitive assertions in languageSearch.spec.ts that
reflected values changed upstream in API 1.4:
- "Kamarakotos" (aoc's former autonym) was removed from langtags.json, so
  the find-by-autonym test now uses Korean (kor).
- caa (Ch'orti')'s autonym now begins with "cho", so it legitimately ranks
  above xco (Chorasmian) for the query "cho"; the ranking assertion was
  updated accordingly.

Ran the full find-language test suite (npx vitest run): 172/172 pass.
The langtag-processing pipeline's remaining console warnings are all the
documented known macrolanguage anomalies (nor, san, hbs, zap).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ndling

https://issues.bloomlibrary.org/youtrack/issue/BL-15916

Per Noel's note on the card, add a test for our handling of the wsg/gon and
arb/ar language pairs. arb/ar already had substantial coverage, but the Gondi
macrolanguage (gon) and its individual members (wsg, esg, gno) had none.

The new test asserts, for both a simple representative pair (arb/ara) and a
multi-member macrolanguage (gon):
- the macrolanguage and its individual members are all findable by name;
- the representative individual language is surfaced by its own ISO 639-3
  code (arb, gno) with the individual language subtag, not the macrolanguage
  subtag, and with parentMacrolanguage set;
- searching the macrolanguage code (gon) surfaces the individual members;
- wsg (Adilabad Gondi) absorbs the retired code "ggo", so searching "ggo"
  still finds it.

Ran the full find-language test suite (npx vitest run): all pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
https://issues.bloomlibrary.org/youtrack/issue/BL-15916

The card notes that the raw source files and the files our pipeline generates
from them lived together in one folder and should be separated. Move the raw
source files into a new language-data/source/ subfolder, leaving the generated
files (languageData.json, equivalentTags.json), which the runtime imports, in
language-data/:

- language-data/source/langtags.json
- language-data/source/iso-639-3.tab
- language-data/source/iso-639-3-macrolanguages.tab

Updated the source-file import/read paths in langtagProcessing.ts and
langtagProcessingHelpers.ts, and the Data sources section of the README.

Verified: re-running the langtag-processing pipeline from the new paths
produces byte-identical languageData.json and equivalentTags.json; tsc
typecheck passes; the full find-language test suite passes (174/174).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@andrew-polk

Copy link
Copy Markdown
Contributor Author

Claude (Opus 4.8): Consulted Devin on 2026-07-22 15:58 USMST up to commit 81987913632c8094a17442efa9c7a34715a2d135.

Devin's review is clean: 0 Bugs, 0 Investigate flags. It raised 3 Informational observations (not mirrored as threads, per our low-signal policy) — all confirming the change looks correct: (1) the ararb consolidation via the new iso639_3 derivation is intended and validated by the arb/ara test; (2) the "byte-identical output" claim proves pipeline determinism (the real correctness signal is the passing suite + restored region/tag counts); (3) the two data-sensitive test assertion changes are legitimate upstream-data updates, not masked regressions. No action needed.

…t cards

https://issues.bloomlibrary.org/youtrack/issue/BL-15916

The "Search with typos gets fuzzy matches" e2e expected the Russian card to be
on screen immediately after searching "rusian". The result list lazy-renders
its cards (react-lazyload): a card far enough down the list isn't in the DOM
until the list is scrolled near it, so scrollIntoViewIfNeeded has nothing to
scroll to. Russian is a fuzzy match that isn't near the top ("Belarusian" is an
exact substring match and outranks it), so it can sit below the initially
rendered window — and the langtags.json API 1.4 data nudged it from list
position 9 to 10, just past that window, which is why the test started timing
out. This is not a search regression (Russian is still surfaced, just not at
the top).

Add a scrollListToLanguageCard helper that scrolls the results list a screenful
at a time until the requested card mounts, then brings it into view, and use it
in the typos test. This makes the assertion robust to where a card lands in the
list rather than depending on it being in the initial lazy-render window.

Note: could not run the e2e locally to confirm (an unrelated local-environment
issue makes the beforeEach clearSearch step time out here); relying on CI, where
the test actually fails, to validate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@andrew-polk

Copy link
Copy Markdown
Contributor Author

Claude (Opus 4.8): Consulted Devin on 2026-07-22 16:48 USMST up to commit d2b54713fa70d20785a2f292c90f2ee74a6bbc42 (the e2e-robustness commit). Re-review is clean: 0 Bugs, 0 Investigate flags, 5 Informational (not mirrored). The informational items are all observations on the (unchanged) langtagProcessing derivation and the two data-driven test-assertion updates — nothing about the e2e change, and none actionable (e.g. the "spurious deprecated 3-letter code" note is theoretical; the local review empirically confirmed 0 such cases in the actual data). No action needed.

@andrew-polk
andrew-polk marked this pull request as ready for review July 23, 2026 00:05
@andrew-polk
andrew-polk requested a review from nabalone July 23, 2026 00:08
@andrew-polk

Copy link
Copy Markdown
Contributor Author

@nabalone Will you please look at at least the new macrolanguage test and the loop to add the iso639 code when it is missing?
You don't necessarily need to review the whole thing, though that's most of it.
Thanks!

@hatton
hatton merged commit e320668 into main Jul 27, 2026
1 of 2 checks passed
@hatton
hatton deleted the BL-15916-update-language-data branch July 27, 2026 21:18
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.

2 participants