L10n (Pt): matches all Portuguese locales, not only bare pt - #2521
Merged
Conversation
359cb0a renamed the key from `pt_BR` to `pt` but kept the exact-match guard, so only the literal string `pt` matched. Every real Portuguese locale (`pt_BR`, `pt_PT` and their charset and modifier variants) fell through to `goto error` and aborted. Return the offset unconditionally, matching every other two-letter case.
HashimAbdulaziz
force-pushed
the
locale-fix
branch
from
August 16, 2026 06:08
76399d6 to
484e535
Compare
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.
Summary
359cb0a79a3531e382fdb0c99357252936f08bf2renamed the key frompt_BRtoptbut keptthe exact-match guard, changing only the compared string. The guard was correct when the
key was region-qualified; now it means only the literal string
ptmatches, so every realPortuguese locale falls through to
goto errorand aborts:All 8 Portuguese locales installed on this machine (
pt_BR,pt_PT, and their.utf8/.iso88591/@eurovariants) abort. Only the literal valuept, which nosystem sets as a locale, still works.
Before that commit,
LC_ALL=pt_BR.utf8printedSistema operacional.Related issue
N/A — noticed while testing
key-languageauto-detection across installed locales.Changes
case 'pt'now returns the offset unconditionally, matching every other two-letter case(
de,es,fr,it, …), sopt,pt_BRandpt_PTall resolve to Portuguese.zhdeliberately keeps its guard — barezhandzh_HKstill error, as the comment abovethe switch describes.
pthas no equivalent ambiguity between two written forms, and nocomment claiming the strictness is intentional, so this reads as leftover shape from the
rename rather than a design decision. If you did intend
ptto be exact-only, say so andI'll close this.
One note: the strings are Brazilian (
Sistema operacional; European Portuguese would beSistema operativo), so this mapspt_PTonto Brazilian wording. That follows fromnaming the key
pt, and is still closer than falling back to English — but it's your call.Testing
Fedora 43, x86_64, glibc 2.42. Differential over all 890 locales from
locale -a,--key-language "", against2de674ec9:The 8 are exactly the
pt_*locales.zh_CN/zh_TWstill resolve,zhandzh_HKstill error. Explicit
--key-language ptand--key-language pt_BRboth work; otherexplicit values are unaffected. Valgrind: 0 bytes lost, 0 errors.
Screenshots
No visual changes.
Checklist