Bug 456285

Summary: The new language and region KCM hardcodes "locale-gen".
Product: [Applications] systemsettings Reporter: Luca Beltrame <lbeltrame>
Component: kcm_regionandlangAssignee: Eike Hein <hein>
Status: RESOLVED FIXED    
Severity: normal CC: hanyoung, nate, plasma-bugs-null, sitter
Priority: NOR    
Version First Reported In: master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 5.26
Sentry Crash Report:

Description Luca Beltrame 2022-07-03 15:52:52 UTC
SUMMARY

The new merged language and regional options KCM requires "locale-gen" to handle translations. However, some distribution do not have a "locale-gen" binary available. For example, openSUSE ships all locales already generated in a specific package. This would affect also all distributions which handle locales in the same manner.

That would not be a problem per se, however the need of "locale-gen" is hardcoded in the KCM.  

OBSERVED RESULT

The KCM depends on "locale-gen" to handle locale generation.

EXPECTED RESULT

The KCM should not hardcode the need for "locale-gen" and should use already generated locales if available.
Comment 1 Harald Sitter 2022-07-03 16:09:25 UTC
It's not hardcoded though, is it? you just need to add a distro specific handler, like already exists for ubuntu.
Comment 2 hanyoung 2022-07-03 16:12:17 UTC
If "/etc/locale.gen" doesn't exists, the KCM doesn't call "locale-gen". Which is the case for fedora. I don't know about open SUSE, but I assume distros that come with locale pre-generated will not ship the "locale.gen" file.
Comment 3 Luca Beltrame 2022-07-03 16:35:25 UTC
(In reply to hanyoung from comment #2)
> If "/etc/locale.gen" doesn't exists, the KCM doesn't call "locale-gen".
> Which is the case for fedora. I don't know about open SUSE, but I assume
> distros that come with locale pre-generated will not ship the "locale.gen"
> file.

I confirm that locale.gen is not present here. 

The problem is that to use glibc-based locales you need to enable support for locale-gen, which in turn enables polkit support for it via the helper. This may be undesirable if not needed (it hasn't gone through any security review, has it? Not saying it needs one, but that some may not want it). Currently you either disable glibc support altogether, or you install the helper.

Of course, if all the "glibc support" does once enabled is running locale-gen, downstreams can just disable it if needed. Can you confirm or deny it is  the case?
Comment 4 Luca Beltrame 2022-07-03 16:38:34 UTC
(In reply to Harald Sitter from comment #1)
> It's not hardcoded though, is it? you just need to add a distro specific
> handler, like already exists for ubuntu.

I don't think it should be done like this, but this discussion is better suited for plasma-devel and not a bug report.
Comment 5 Nate Graham 2022-07-07 16:02:09 UTC
Fixed with the commits in https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1891.