Skip to content

BL-15882_reopen_to_macrolanguage#135

Merged
andrew-polk merged 1 commit intomainfrom
BL-15882_reopen_to_macrolanguage
Feb 16, 2026
Merged

BL-15882_reopen_to_macrolanguage#135
andrew-polk merged 1 commit intomainfrom
BL-15882_reopen_to_macrolanguage

Conversation

@nabalone
Copy link
Collaborator

@nabalone nabalone commented Feb 16, 2026

This change is Reviewable

Copy link
Contributor

@andrew-polk andrew-polk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrew-polk reviewed 6 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @nabalone).


components/language-chooser/common/find-language/searchForLanguage.ts line 105 at r1 (raw file):

  //  handled
  //  by the searchResultModifier
  const correctedCode = code === "zh" ? "cmn" : code;

devin:


components/language-chooser/common/find-language/searchForLanguage.ts:R105

Case-sensitive zh check breaks case-insensitive contract of getLanguageBySubtag

The new code === "zh" check at searchForLanguage.ts:105 is case-sensitive, but getLanguageBySubtag (and by extension parseLangtagFromLangChooser) is expected to be case-insensitive, as demonstrated by the existing test parseLangtagFromLangChooser("cE-CyRl-rU") succeeding.

Root Cause and Impact

When parseLangtagFromLangChooser("ZH-Hant") is called, splitTag does not normalize case (components/language-chooser/common/find-language/languageTagUtils.ts:241), so languageSubtag is "ZH". Then getLanguageBySubtag("ZH", searchResultModifier) is called. Because "ZH" !== "zh", the correction to "cmn" is skipped, and correctedCode remains "ZH".

Fuse.js (which is case-insensitive by default) then searches for "ZH" and may find the zho macrolanguage entry (which has languageSubtag: "zh") instead of the intended cmn entry.

  • Without a modifier: Returns the zho macrolanguage entry instead of the data-rich cmn entry.
  • With defaultSearchResultModifier: zho is in EXCLUDED_PROBLEMATIC_LANGUAGE_CODES (searchResultModifiers.ts:246), so it gets filtered out, and the function returns undefined — causing parseLangtagFromLangChooser to fail for a valid Chinese tag.

Impact: Any caller passing an uppercase or mixed-case "zh" language subtag (e.g. "ZH-Hant", "Zh-CN") to parseLangtagFromLangChooser or getLanguageBySubtag will get incorrect results or undefined for Chinese.

@nabalone nabalone force-pushed the BL-15882_reopen_to_macrolanguage branch from 2c24f9d to fe666d5 Compare February 16, 2026 16:28
Copy link
Contributor

@andrew-polk andrew-polk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrew-polk reviewed 2 files and all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @nabalone).

Copy link
Contributor

@andrew-polk andrew-polk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrew-polk resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @nabalone).

@andrew-polk andrew-polk merged commit 175be92 into main Feb 16, 2026
2 checks passed
@andrew-polk andrew-polk deleted the BL-15882_reopen_to_macrolanguage branch February 16, 2026 16:42
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