mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-16 15:33:02 +01:00
LSformElement::labeledValue: add translate_labels parameter and fix translating it
This commit is contained in:
parent
b00f59af2e
commit
b93187f208
3 changed files with 19 additions and 2 deletions
|
@ -12,6 +12,7 @@
|
|||
'label2' => 'Libellé label2',
|
||||
[...]
|
||||
),
|
||||
'translate_labels' => [booléen],
|
||||
),]]>
|
||||
...
|
||||
</programlisting>
|
||||
|
@ -28,6 +29,13 @@
|
|||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>translate_labels</term>
|
||||
<listitem>
|
||||
<simpara>Booléen permettant d'activer/désactiver la traduction des labels (Par defaut : <literal>Vrai</literal>).</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
</sect4>
|
||||
|
|
|
@ -50,8 +50,16 @@ class LSformElement_labeledValue extends LSformElement {
|
|||
foreach($this -> values as $val) {
|
||||
$parseValues[]=$this -> parseValue($val);
|
||||
}
|
||||
|
||||
// Translate labels
|
||||
$labels = $this -> getParam('html_options.labels', array());
|
||||
if ($this -> getParam('html_options.translate_labels', true, 'bool')) {
|
||||
foreach($labels as $value => $label)
|
||||
$labels[$value] = __($label);
|
||||
}
|
||||
|
||||
$return['html'] = $this -> fetchTemplate(NULL,array(
|
||||
'labels' => $this -> getParam('html_options.labels'),
|
||||
'labels' => $labels,
|
||||
'parseValues' => $parseValues,
|
||||
'unrecognizedValueTxt' => __('(unrecognized value)'),
|
||||
'unrecognizedLabelTxt' => __('(unrecognized label)'),
|
||||
|
|
|
@ -626,6 +626,7 @@ function cli_generate_lang_file($command_args) {
|
|||
}
|
||||
break;
|
||||
case 'labeledValue':
|
||||
if (LSconfig :: get("LSobjects.$obj.attrs.$attr.html_options.translate_labels", True, "bool"))
|
||||
addFromLSconfig("LSobjects.$obj.attrs.$attr.html_options.labels.*");
|
||||
break;
|
||||
case 'password':
|
||||
|
|
Loading…
Reference in a new issue