-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
4.1.11
-
MOODLE_401_STABLE
When an user is trying to set multi-language in the type of fields checkbox, radiobutton, menu and multi-select using the mod_data resource, the translation is not working.
Didn't worked even with both filters installed, filter_multilang and filter_multilang2.
The only way it worked, was modify some lines in the next files:
~/moodle/mod/data/field/checkbox/field.class.php
Line 96
$str .= '<label for="field_'.$this->field->id.'_'.$i.'">'.format_text($checkbox).'</label><br />';
instead of
$str .= '<label for="field_'.$this->field->id.'_'.$i.'">'.$checkbox.'</label><br />';
Line 227
$str .= format_text($line) . "<br />\n";
instead of
$str .= $line . "<br />\n";
~/moodle/mod/data/field/menu/field.class.php
Line 74
$options[$option] = format_text($option);
instead of
$options[$option] = $option;
~/moodle/mod/data/field/multimenu/field.class.php
Line 100
$str .= format_text($option) . '</option>';
instead of
$str .= $option . '</option>';
Line 289
$str .= format_text($line) . "<br />\n";
instead of
$str .= $line . "<br />\n";
~/moodle/mod/data/field/radiobutton/field.class.php
Linea 100
$str .= '<label for="field_'.$this->field->id.'_'.$i.'">'.format_text($radio).'</label><br />';
instead of
$str .= '<label for="field_'.$this->field->id.'_'.$i.'">'.$radio.'</label><br />';
Without these changes in the code, the multi-language show this code
{mlang en}Option 1{mlang}{mlang es}Opción 1{mlang}{mlang pt_br}Opção 1{mlang}{mlang fr}Option 1{mlang}{mlang en}Option 2{mlang}
{mlang es}Opción 2{mlang}{mlang pt_br}Opção 1{mlang}{mlang fr}Option 2{mlang}Steps to reproduce the bug:
- Be sure to have installed the filter filter_multilang2 (https://moodle.org/plugins/filter_multilang2)
- Create a data resource
- Add a new field of these checkbox, radiobutton, menu and multi-select, for example menu (dropdown list)
- Set a name and the options, for example, the following ones, based on the languages of any moodle installation {mlang en}Option 1{mlang}{mlang es}
Opción 1{mlang}
{mlang pt_br}Opção 1{mlang}{mlang fr}Option 1{mlang} {mlang en}Option 2{mlang}{mlang es}Opción 2{mlang}{mlang pt_br}Opção 1{mlang}
{mlang fr}Option 2{mlang}
- Add a new entry, the filter is not being applied in the "Add entry" template and even in the "View" template, after the entry was saved.
Melvyn
- has been marked as being related by
-
MDL-77015 HTML in database field management page escaped in an unexpected way
-
- Closed
-