Skip to content

Read a locale's script and region only from its language tag - #983

Merged
CryZe merged 1 commit into
LiveSplit:masterfrom
CryZe:language-tag-before-extensions
Nov 15, 2026
Merged

CryZe merged 1 commit into
LiveSplit:masterfrom
CryZe:language-tag-before-extensions

Conversation

@CryZe

@CryZe CryZe commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Lang::parse_locale scans every subtag of a locale for a script, a region or BR, including those after an extension or private-use singleton (-u-…, -x-…). Their subtags can look like scripts or regions without being one, so since #982 zh-Hant-TW-x-hans parses as Simplified Chinese, and pt-PT-x-br has always parsed as Brazilian Portuguese.

The scan now stops at the first single-letter subtag, which starts an extension or private use. The existing locale test gains these cases and extensions that follow a script or region of the tag itself (zh-Hans-u-co-hk, pt-BR-u-ca-gregory).

`Lang::parse_locale` scanned every subtag of a locale for a script, a
region or `BR`, including those after an extension or private-use
singleton. Their subtags can look like scripts or regions without being
one, so `zh-Hant-TW-x-hans` parsed as Simplified Chinese and
`pt-PT-x-br` as Brazilian Portuguese.

The scan now stops at the first single-letter subtag, which starts an
extension or private use. The test covers both cases and extensions that
follow a script or region of the tag itself.
@CryZe CryZe added bug There is a bug. rust Pull requests that update Rust code localization This is about the localization. labels Nov 15, 2026
@CryZe CryZe self-assigned this Nov 15, 2026
@CryZe CryZe added this to the v0.14 milestone Nov 15, 2026
@CryZe
CryZe enabled auto-merge (squash) November 15, 2026 14:18
@CryZe
CryZe merged commit 428d1ea into LiveSplit:master Nov 15, 2026
69 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug There is a bug. localization This is about the localization. rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant