locale: Load system locale from /etc/default/locale#282
Open
Taresu wants to merge 1 commit into
Open
Conversation
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.
Problem
When the system locale is configured in
/etc/default/locale(e.g.LANG=pt_BR.UTF-8), PAM messages shown by slick-greeter during login (password expiry warnings, password quality checks) appear in English instead of the configured language.The root cause is that LightDM does not load
/etc/default/localewhen spawning the greeter process. This is by design: in LightDM'sseat.c,create_greeter_session()does not apply language configuration -> thatonly happens for user sessions. As a result, the greeter inherits a minimal environment with no locale variables set.
The greeter already calls
Intl.setlocale(LocaleCategory.ALL, "")at startup, but with noLANGorLC_*variables in the environment it always falls back to theClocale, and all PAM message translations are ignored.References
Affected versions
1.0.0 through 2.2.6 (current) - all Linux Mint releases from 18.3 (Sonya) to 22.3 (Zena).
Steps to reproduce
/etc/default/locale(e.g.LANG=pt_BR.UTF-8).sudo chage -d 0 <user>.Expected behaviour
PAM messages shown by the greeter should honour the system locale configured in
/etc/default/locale.Fix
Added
load_locale()insrc/slick-greeter.vala, called immediately beforeIntl.setlocale(). It reads/etc/default/locale, parsesKEY=valuelines (strips quotes, skips comments), and sets any missing locale environment variables. This is modeled on the existing/etc/default/keyboardreading pattern already used inmenubar.vala(added in commit 1aa6d58).Closes #142