[systemd-devel] Dynamic locale changes with localed

Lennart Poettering lennart at poettering.net
Fri Jul 12 11:48:46 PDT 2013


On Tue, 02.07.13 21:42, Tristan Van Berkom (tristanvb at openismus.com) wrote:

> Hello Mailing List.
> 
> I have a quick question about the org.freedesktop.locale1 interface.
> 
> I've been working on some locale bound addressbook features for
> Evolution Data Server, and we wanted a feature to handle locale
> changes dynamically.
> 
> To handle this, we thought for starters it would be a good idea
> to listen for 'Locale' property changes on the interface defined
> here:
>     http://www.freedesktop.org/wiki/Software/systemd/localed
> 
> This seems to work well but I've only tested receiving the
> locale changes so far (using GTestDBus in an encapsulated
> D-Bus environment... which we use in unit tests).
> 
> Now that we're trying this in a running system, we're
> encountering some problems (or, the functionality is
> perhaps just not exactly what we expected).
> 
> When calling the 'SetLocale' D-Bus method on the said
> interface, there is some latency, and I wonder if the
> values are policed somehow by the localed daemon (specifically,
> when setting some locales, the following 'Locale' property
> change notifications sends the 'C' locale instead of the
> locale which we set).

Hmm, that sounds like a bug. Could you file one on fdo?

Normally the event should happen instantaneous. There might be some
cleaning up of passed in locales (especially regarding the empty
locale, and "C"), but what you oass in should be applied.

See simplify() in
http://cgit.freedesktop.org/systemd/systemd/tree/src/locale/localed.c#n173

The locale handling is here:

http://cgit.freedesktop.org/systemd/systemd/tree/src/locale/localed.c#n995

The only thing that might cause a delay in there is the polkit
interaction?

> Are there any constraints to what values are acceptable
> to pass to 'SetLocale' ? Perhaps the locale data for a given
> locale must be installed on the said system to be accepted
> by (and then propagated) localed ?

We do not do such checking for installed locales, but we probably
should, and this has been requested before.

> Perhaps there is some latency only to synchronize the setting
> into some database ?

Not really. The bus signal should come immediately after the polkit
transaciton. Of course, system services see the locale change after they
are restarted. And user programs only after the user logged out/back
in -- if at all, because the DE overrides the system setting.

> Is there any information (or documentation) regarding how
> the localed daemon is expected to work which could help us
> test our dynamic locale changes ?

There is this:

http://www.freedesktop.org/wiki/Software/systemd/localed/

And that's it.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list