[horde] Setting date and time preferences

Jens Wahnes wahnes at uni-koeln.de
Thu Apr 23 13:09:57 UTC 2015


On Thu, Apr 23 2015, at 10:37:25 +0200, Jan Schneider wrote:

> Zitat von Jens Wahnes <wahnes at uni-koeln.de>:
>> If you bear with me, could you give me a hint how I could further
>> improve my "12 hour vs. 24 hour" config by actually using a hook? In
>> that hook, I would like to set the default value of the "twentyFour"
>> pref depending on the locale of the currently logged in user. E.g.,
>> when the locale is "en_US", leave it at false, otherwise, change it to
>> true. (Or something more sophisticated even, which I could eventually
>> share with other Horde users who might be interested in this as well.)
>> How could I go about doing that?

> Are you asking how to create a hook for that preference, or how to  
> implement it? The former is documented in prefs.php and hooks.php.dist.

Thanks, I got the basics of it working, I think.

From an algorithmic point of view, it's exceedingly simple to
implement, actually. But there is one problem, that is, how to get the
value of the currently used locale from inside that hook?

I tried to use

$currentlocale = $scope_ob->get("language");

but that doesn't seem to work (there isn't any value set). I guess this
is so because I didn't explicitly set the "language" pref -- instead,
the language chosen on the login screen is used implicitly by Horde.
How does the magic happen that presets the locale? Is there a way to
access that information? I've read the remark in the docs that says
"Because the prefs_init hook is called BEFORE the application is
initialized, application data will not be available in this hook.", but
then I don't know what is meant by 'application data' in this context.
So, am I running into this 'application data' problem?


Jens
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.horde.org/archives/horde/attachments/20150423/c34972fa/attachment.bin>


More information about the horde mailing list