Locale settings in Plasma Next

John Layt jlayt at kde.org
Mon Mar 10 10:13:23 UTC 2014


On 10 March 2014 10:11, Martin Klapetek <martin.klapetek at gmail.com> wrote:
> On Sun, Feb 23, 2014 at 8:10 PM, John Layt <jlayt at kde.org> wrote:

> Any ETA on the QLocale changes? Any particular plans with which we can help?
> I'd be happy to help out there.

I'm hoping for Qt 5.4, but this is something that needs to be 100%
correct on all platforms before it goes in so getting it done is
proving to be a pain.  We've been through Plans A thru D so far...  I
plan to get focussed back on it once Frameworks goes Beta 1 and my
stuff in Qt 5.3 is stabilised, so I'll ping you then with my plans.

> Some sort of temporary/transient KCM comes to mind...we could simply list
> the locale items ("Numeric system", "Time", "Money formatting"...) and
> combobox next to it with available locales, presented as countries ("Czech
> Republic", "Germany", "USA"...). It would be a bit ugly tho, but it would
> serve its purpose. Or have no KCM at all...I imagine the percentage of
> people setting different locales for each thing will be quite minimal...plus
> we can advertise that this will come back later (whenever QLocale is ready).

Funny enough, I spent Sunday working on that.  I'm splitting
kde-runtime/kcontrol/locale into the two kcm's as I described below,
one for Translations which for now is just the old ui, and one for
Formats which for now is a list of combo's for the 6 envvars Qt uses.
It is indeed ugly, and I can think of prettier/friendlier ways to do
it, but it's functionality that counts for now.

One point that came out of it was the realisation that the code will
move from kde-runtime/kcontrol into kde-workspace/kcontrol, as it
really is configuring the locale for all apps running under Plasma
Next, not configuring KDE apps running everywhere.

I actually spent most of the day looking at Gnome3 code to see what
they are doing (my eyes!), a few other desktops too, some distros, and
systemd / localed to see how that fits in.  I'll write up a more
detailed design/spec for what it needs to do over the next couple of
days.

>> For KDE4 apps running under Plasma Next, I wonder if it will be too confusing
>> having them using different locale settings than the KF5 apps?
>
> I'd be all for that, except that if people will have two sessions on their
> PCs, one for KDE4 and the other for Next, try out Next one time and this
> will nuke their KDE4 session settings, I imagine this will make them
> unhappy. And I think this will be quite common use case from the beginning
> as people will want to try things out. We could put a warning there, but
> that might scare some people off = less testing. Can we just override the
> KDE4 kdeglobals from Next? We could simply change the path or something and
> then the KDE4 apps won't be reading the KDE4 session kdeglobals file.

Yes, good point, wiping settings is a no-no in that scenario.

We actually have two scenarios we need to work with here
1) KF5 apps still using KLocale from kde4support
2) KDE4 apps using KLocale from kdelibs

For 1, I think I we should patch kde4support/KLocale to check what
platform it is running under, by default it should use the user locale
but ignore the individual user overrides, but if running under KDE4 (I
assume that's a valid scenario?) then it should use the overrides.
What's a good way to detect that?

For 2, I think the same rule should probably apply, but that would
require patching kdelibs (can we still?).  Alternatively we'd have to
mess with the paths.  I'll need to look into that more.

>> One question is when these changes to the envvars will get applied, and
>> the action required to apply them to the apps.
>
> I think restarting Plasma while running would be easy. As to if it should be
> considered dangerous, I'm not educated enough to answer that.

I think to start with we'll just force users to log out, less code,
but we can work toward dynamic reloading (Qt has an event signal for
that, I plan to make it actually work at some stage).

>> I guess another obvious question is where to save the envvar settings, I
>> guess kdeglobals still?  Or somewhere new?
>
> Not sure about this either...

I'll put it there for now, we'll be reusing the existing Languages
setting and just adding new ones for the LC_* overrides.

>> Longer term we will need to restore the ability to edit the individual
>> settings and I have a roadmap for that.
>
> Will there be QLocale/QML Locale support for that too? That'd be great ;)

Yes, the plan is actually for all apps, Qt and Gtk and whatever, to
use our settings, otherwise it 's a bad user experience to have
different apps using different settings.  It just requires some magic
and for other toolkits to be following the POSIX standard properly.
The simplest way is just to have QLocale load our settings, probably
from a CLDR format json file, perhaps via the platform plugin, but
that would only work for all Qt apps.  The POSIX spec actually says if
a locale envvar like LANG starts with a / then it's an absolute path
to the locale file to be loaded, so assuming all the other toolkits
actually do that then we could just write our settings out to a
standard locale file for others to use.

Cheers!

John.


More information about the Plasma-devel mailing list