Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-82579

Multi-lingual not working in specific type of fields in the database resource

XMLWordPrintable

    • 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

            Unassigned Unassigned
            melvyng melvyng
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.