[imp] Preferred Language

Michael M Slusarz slusarz at horde.org
Wed Nov 14 18:44:00 UTC 2012


Quoting Hanns Mattes <hanns at hannsmattes.de>:

> Hi,
>
> Zitat von Michael M Slusarz <slusarz at horde.org>:
>
>> Quoting Hanns Mattes <hanns at hannsmattes.de>:
>>
>>> Hi,
>>>
>>> digging through my horde/omp-installation, I've found a minor  
>>> quirk in the settings of the prefferred language when receiving an  
>>> answer to a message. There is an option to select on ore more  
>>> languages, but in my installation, there are no languages listed  
>>> to select from.
>>>
>>> Any idea what's going wrong?
>>
>> The language list is generated in the 'on_init' parameter to the  
>> 'reply_lang' preference (imp/config/prefs.php):
>>
>> $_prefs['reply_lang'] = array(
>>    [...]
>>    'on_init' => function($ui) {
>>        $enum = Horde_Nls::getLanguageISO();
>>        asort($enum);
>>        $ui->prefs['reply_lang']['enum'] = $enum;
>>    }
>> );
>>
>> That would be the place to start debugging.
>
> Thanks. Your advice made me control my prefs.local-file and disable  
> it. Obviously, I've messed something up. Now the list of languages  
> shows up as desired.

My guess, and probably something others have done as well, is as follows:

1. Someone wants to change default value of pref (we'll use reply_lang  
as example).
2. They copy/paste the entry from prefs.php:

$_prefs['reply_lang'] = array(
     // 'value' => serialize(array())
     'value' => 'a:0:{}',
     'advanced' => true,
     'type' => 'multienum',
     'enum' => array(),
     'desc' => _("What language(s) do you prefer replies to your  
messages to be in? (Hold down the CTRL key when clicking to add  
multiple languages)"),
     'on_init' => function($ui) {
         $enum = Horde_Nls::getLanguageISO();
         asort($enum);
         $ui->prefs['reply_lang']['enum'] = $enum;
     },
);

to their prefs.local.php.
3. They delete everything but the value they want to change:
$_prefs['reply_lang'] = array(
     'value' => 'a:0:{}'
);

The problem now is that all the other properties of reply_lang have  
been deleted.

The proper way to set the value in prefs.local.php is as follows:
$_prefs['reply_lang']['value'] = 'a:0:{}';

This only overwrites the 'value' property of reply_lang, not the entire array.

michael

___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the imp mailing list