Fix Linux locale matching and add pt aliases - #968
Augusto Pinto (alghostzx) wants to merge 2 commits into
Conversation
Augusto Pinto (alghostzx)
left a comment
There was a problem hiding this comment.
@microsoft-github-policy-service agree
4316239 to
4346917
Compare
|
@microsoft-github-policy-service agree |
Dustin L. Howett (DHowett)
left a comment
There was a problem hiding this comment.
I feel like this reverts an intentional change we made to address this exact case.
Edit expects the format of the LANG environment variable to follow the rule laid out in IEEE 1003.1 (so, POSIX):
If the locale value has the form:
language[_territory][.codeset]
it refers to an implementation-provided locale, where settings of language, territory, and codeset are implementation-defined.
That is, it comes to us with an underscore. We transform it to contain a -. We should not accept an invalid LANG and then transform it to something that edit internally knows not what to do with.
|
Thanks for the clarification, Dustin L. Howett (@DHowett)! That makes total sense regarding IEEE 1003.1 / POSIX and normalizing to the BCP 47 convention ( I will revert the change in I will update the branch shortly! |
|
I reverted the change in Just pushed the update! |
|
So, what is the actual |
|
So, uh, funny story... |
The binary was compiling with portuguese brazilian locale by default, but wasn't acessible in any way thanks to this little typo I found, I fixed it, hope it's okay. ;)
Summary written by AI
This PR addresses two issues with locale resolution on Linux environments:
Linux locale separator normalization:
In
crates/edit/src/sys/unix.rs,preferred_languagespreviously replaced underscores (_) with hyphens (-). However, the internal build generator sanitizes and matches against identifier patterns using underscores (pt_br), causing common POSIX locales likept_BR.UTF-8to be transformed intopt-BR.UTF-8and subsequently fail the prefix match againstLANGUAGES. Swapping the replacement direction restores expected matching.Portuguese aliases in
edit.toml:Added
ptandpt_braliases pointing topt-brin[__alias__], ensuring users with genericLANG=ptfall back gracefully to the bundled Portuguese translation.