Skip to content

Parse Language from its BCP 47 tag into typed subtags - #949

Merged
mickael-menu merged 3 commits into
developfrom
fix/language
Nov 25, 2026
Merged

mickael-menu merged 3 commits into
developfrom
fix/language

Conversation

@mickael-menu

Copy link
Copy Markdown
Member

Language is now built with Language("en-US") and parsed leniently into a canonical tag, plus typed code, script and region (Language.Code, Language.Script, Language.Region). Each subtag type normalizes its case on creation, can be written as a string literal (so ["GB", "AU"] works for [TTSVoice].sorted(preferredRegions:)), and provides localizedName(in:). _ separators, surrounding whitespace and Locale keywords (@calendar=roc) are ignored.

This fixes the EPUB navigator choosing the wrong layout for publications tagged with a region or a script, such as ar-EG or ja-JP. Both used to get the default stylesheets because tags were compared whole. The RTL and CJK rules follow the Readium CSS internationalization guidance.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@mickael-menu
mickael-menu merged commit 296c89b into develop Nov 25, 2026
5 checks passed
@mickael-menu
mickael-menu deleted the fix/language branch November 25, 2026 15:17
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