View previous topic :: View next topic |
Author |
Message |
nagmat84 Apprentice
Joined: 27 Mar 2007 Posts: 285
|
Posted: Sat Dec 14, 2024 3:20 pm Post subject: Plasma ignores LANG variable for new user accounts [SOLVED] |
|
|
For a fresh user account, Plasma/KDE ignores the environment variable LANG, but falls back to C.UTF-8. Moreover it creates a file ~/.config/plasma-localerc with LANG=C.utf8.
Users can open the system settings and change their locale which updates plasma-localerc to the correct value, but it is annoying. Moreover the system settings greet the user with the warning that C.utf8 was not a valid locale.
Where does KDE take that value C.utf8 from?
I already found a work-around. If I put .config/plasma-localerc into /etc/skel (or in any home directory for users which haven’t yet logged in) with the desired value, Plasma/KDE uses that value. But I am really more interested where Plasma/KDE initially takes the wrong value `C.UTF-8` from, if plasma-localerc doesn’t exist yet and Plasma/KDE generates it automatically.
My setup is a little bit more complex than usual, because I want all system daemons to run with C.UTF-8 (for untranslated log messages), but all user-facing daemons and all UI should be de_DE.UTF-8.
/etc/env.d/02locale is a symbolic link to /etc/locale.conf
/etc/profile.env is a generated file (from /etc/locale.conf and hence also sets LANG="C.UTF-8").
/etc/environment.d/10-gentoo-env.conf, see previous pointLocalization for User-Facing Services and User Default- /etc/locale-users.conf sets
Code: | LANG=de_DE.UTF-8
GDM_LANG=de_DE.UTF-8
LANGUAGE=de_DE:en_US | /etc/environment.d/20-locale.conf is a symbolic link to /etc/locale-users.conf;
as it is lexicographically later, it overrides /etc/environment.d/10-gentoo-env.conf. The SystemD User Service Manager parses the directory /etc/environment.d/ for each user service it starts.
For the SystemD User Service Manager itself, I have a service drop-in via /etc/systemd/system/user@.service.d/override.conf with: Code: | [Service]
EnvironmentFile=-/etc/locale-users.conf | (The idea for that is from Arch Wiki: SystemD User - Environment Variables.) Localization for Individual Users- In /etc/skel and the home directory of each user the file .config/environment.d/20-locale.conf sets
I can confirm that the setup generally works as it should. For any other environment variable than LANG the command systemctl --user show-environment outputs the value as set in locale-users.conf. However, for LANG Plasma/KDE somehow seems to overwrite it and fall back to C.UTF-8. Why?
My only explanation so far is that Plasma/KDE explicitly parses /etc/locale.conf (or some other system-wide configuration file) and overwrites the environment variables with those values instead honoring what is already set. |
|
Back to top |
|
|
nagmat84 Apprentice
Joined: 27 Mar 2007 Posts: 285
|
Posted: Sun Dec 15, 2024 4:44 pm Post subject: |
|
|
I found the solution. IMHO it is a bug either in Plasma/KDE or SDDM or both. In essence, SDDM clears all environment variables and then explicitly loads LANG from /etc/locale.conf. This is hard-coded into SDDM. From there, startplasmas-wayland inherits the (wrong) environment variable.
This approach works if one assumes that the entire system is localized to the same locale and that each user uses the same locale. This attempt fails if the system uses a different locale than the users of if users intent to use their individual locales. I wonder why this hasn't been noticed earlier. Maybe, multi-user multi-locale systems aren't that wide-spread after all and most users only use their PC for themselves.
The upstream bug reports are |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|