nagmat84 Apprentice
Joined: 27 Mar 2007 Posts: 282
|
Posted: Sat Dec 14, 2024 3:20 pm Post subject: Plasma/KDE ignores LANG variable for new user accounts |
|
|
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. |
|