Repository navigation
i18n: validate every ICU select occurrence per variable - #1348
Merged
Aymericr merged 1 commit intoDec 3, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Follow-up from #1344 / #1347 review feedback:
selects()inscripts/i18n.tsto collect an array of branch sets per selector variable (Map<string, Set<string>[]>) instead of overwriting earlier occurrences withMap.set.selectoccurrence against a distinct translated occurrence using bipartite superset matching (findMaxSelectMatches) so translators can still reorder duplicate select clauses naturally, while catching any dropped branch, deleted duplicate select, or missingotherbranch on any occurrence.scripts/i18n.test.tscovering dropped branches in earlier occurrences, missingotherin earlier or extra occurrences, reordered clauses, and removed duplicate selects.Verification
bun test scripts/i18n.test.ts(14/14 pass, 76 assertions)biome checkclean (0 issues)Note
Low Risk
Changes are confined to translation validation logic in
scripts/i18n.tswith matching tests; no runtime or catalog shipping behavior is altered.Overview
Fixes ICU
selectvalidation when the same selector variable appears more than once in a message.selects()now records an ordered list of branch sets per variable instead of keeping only the last occurrence.validateTranslationpairs each Englishselectwith a distinct translation occurrence viafindMaxSelectMatches(bipartite superset matching), so translators can reorder duplicate clauses but edits must still preserve every branch, every duplicate block, andotheron each occurrence. Regression tests inscripts/i18n.test.tscover dropped branches, missingother, reordering, removed duplicates, and extra-only selectors.Reviewed by Cursor Bugbot for commit 04e4820. Bugbot is set up for automated code reviews on this repo. Configure here.