Bug 478120 - Changing locale from anything else to pt_PT on Languages KCM does not update locale files correctly
Summary: Changing locale from anything else to pt_PT on Languages KCM does not update ...
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_regionandlang (show other bugs)
Version: 5.27.9
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
Depends on:
Reported: 2023-12-05 19:03 UTC by Eduardo Correia
Modified: 2023-12-09 04:45 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0


Note You need to log in before you can comment on or make changes to this bug.
Description Eduardo Correia 2023-12-05 19:03:34 UTC
I am still unsure if this is a distro-specific problem or a KDE problem I have tested on Nobara and stock Fedora on both my machines and the problem exists on both. I am also unsure of where to report this bug, so I ask any admin/mod to correctly assign this report to its correct category/component.

When changing from any language to "European Portuguese" (or "Português europeu"), the system locale is not updated correctly, even after re-login. In region & language KCM, changing to any language usually results in locale files being updated, and stuff like "cat /var/lib/AccountsService/users/${USER}" returning a line "Languages=en_US.UTF-8;" .

However, when you select "Português europeu" from the language options, and click the Apply button, when it automatically goes back to the main page of this KCM, it still shows the previously configured language. It didn´t apply the new locale correctly. Also, if you do "cat /var/lib/AccountsService/users/${USER}¨ in the console, it still shows the previous locale in the Languages line. If you change to any other language, this line gets updated correctly. If you delete this line, and change to any other language, this line gets added again. But if you delete this line, and then change to pt_PT ("português europeu" option) and check that file again, this line is NOT added. Whatever function is adding/updating this line for other languages, it's not doing it for pt_PT . This is also reflected in the whole system, as everything is still shown with the locale that was previously correctly set, which means that the system locale is not being updated at all, after choosing portuguese european. Still, if you go do change the language in the region & languages KCM, it shows portuguese european added on that list, even though it had absolutely no effect on the system.

If you check plasma-localerc in the user .config folder, a similar behaviour exists: the [Translations] line is correctly updated, but the [Formats] line is NOT updated if the language is pt_PT. If you choose any other language, [Formats] is updated correctly.

If you add multiple languages to the list in this KCM, they are all listed correctly in plasma-localerc, but similarly, the [Formats] line and this file: "/var/lib/AccountsService/users/${USER}" are NOT updated if the locale pt_PT is on the top of the locales list. If you move any other language from that list to the top, everything is updated correctly. Move european portuguese to the top of the list again, and all changes get ignored/don't do anything. The only thing that gets changed, is the [Translations] line at plasma-localerc.

This might be related to the bug report #454991 , also reported by me some months ago. Even though the problem is different, and that other bug reported is now fixed, the fix for that bug report might have been incomplete or somehow that fix created this new bug.

1. Go into Region & language settings, switch from any language to european portuguese, or add multiple languages with european portuguese on top of the list. Click Apply. Re-login is optional, the problem can be seen either way.
2. Language is not changed at all, files "plasma-localerc" and "/var/lib/AccountsService/users/${USER}" still have the previous language set.
3. Choose any other language, or move any other language to the top of the languages list and click apply, check those same files and confirm that now everything got correctly updated.

KDE locale files not updated correctly after choosing european portuguese.

Everything having the same behaviour as it has changing to any other language.

Linux: 6.6.3-203
KDE Plasma Version: 5.27.9
KDE Frameworks Version: 5.112.0
Qt Version: 5.15.11
Comment 1 Bug Janitor Service 2023-12-06 13:29:55 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/3661
Comment 2 Harald Sitter 2023-12-06 20:38:35 UTC
Git commit d88d5a45de215ebbd076476c830a1d9aaeda8794 by Harald Sitter.
Committed on 06/12/2023 at 21:38.
Pushed by sitter into branch 'master'.

kcms/region_language: repair pt_PT support

this broke because a hack was introduced to change the enumerated name
from pt to pt_PT but that then didn't have a mapping in the glibc table.

to mitigate this and future problems of the sort we now fill the entire
locale name into the mapping table in addition to the presumed language
name. e.g. the table now contains pt=>pt_PT.UTF-8 as well as

M  +12   -3    kcms/region_language/kcmregionandlang.cpp