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

Using moodle-qtype_gapselect with multiple language

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Minor Minor
    • None
    • 3.1.4, 3.1.5, 3.1.6, 3.2, 3.2.1, 3.2.2, 3.2.3, 3.3.4, 3.4.1
    • Questions
    • MOODLE_31_STABLE, MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE
    • MDL-58980-master
    • Hide
      • Install a multilang filter plugin which doesn't relay on HTML tags, e.g. https://moodle.org/plugins/filter_multilang2. This is since HTML tags in gap option texts are not very welcome (some are allowed, though).
      • Enable that filter plugin for content.
      • Aside english install at least another language, e.g. Russian.
      • In a course, go to question bank.
      • Create a new gapselect ("Select missing words") question, name it MDL-58980 test question.
      • Let the question text be {mlang en}Fill in the{mlang}{mlang ru}заполнить{mlang} [[1]]
      • Let choice 1 be {mlang en}Gaps{mlang}{mlang ru}пробелы{mlang}
      • Save changes and continue editing and then preview.
      • Cross check in english you see the english sentence and option.
      • Switch language to russian.
      • Preview again.
      • Cross check in russian you see the russian sentence and option.
      Show
      Install a multilang filter plugin which doesn't relay on HTML tags, e.g. https://moodle.org/plugins/filter_multilang2 . This is since HTML tags in gap option texts are not very welcome (some are allowed, though). Enable that filter plugin for content. Aside english install at least another language, e.g. Russian. In a course, go to question bank. Create a new gapselect ("Select missing words") question, name it MDL-58980 test question. Let the question text be {mlang en}Fill in the{mlang}{mlang ru}заполнить{mlang} [ [1] ] Let choice 1 be {mlang en}Gaps{mlang}{mlang ru}пробелы{mlang} Save changes and continue editing and then preview. Cross check in english you see the english sentence and option. Switch language to russian. Preview again. Cross check in russian you see the russian sentence and option.

      Hi Guys,
      There is an issue with the rendering and the processing of the "Select the missing word" question type when using a multi-language Moodle website.

      I am using multi-lang v2 for my multi-language filter. Maybe the solution works with the v1 too.

       

      Here are the changes I made to make moodle-qtype_gapselect multi-language friendly:

      /question/type/gapselect/rendererbase.php
      Line 99
      $choice->text) . ']';
      and change it to:
      format_string($choice->text)) . ']';

       

      /question/type/gapselect/renderer.php
      Line 60
      $selectoptions[$orderedchoicevalue] = $orderedchoice->text;
      and change it to:
      $selectoptions[$orderedchoicevalue] = format_string($orderedchoice->text);

       

      /question/type/gapselect/renderertypebase.php
      Line 158
      $bits = preg_split('/[[(\d+)]]/', $question->questiontext, null, PREG_SPLIT_DELIM_CAPTURE);
      and change it to:
      $formatedQuestionText = format_string($question->questiontext);
      $bits = preg_split('/[[(\d+)]]/', $formatedQuestionText, null, PREG_SPLIT_DELIM_CAPTURE);

      Any suggestion to better the code?

      Thank you to Iñaki Arenaza for fixing the rendering. See comments section of https://moodle.org/plugins/filter_multilang2

      I hope this helps

      Keep the good work!

      Thank you

            lucaboesch Luca Bösch
            ndalpe Nicolas Dalpe
            Tim Hunt Tim Hunt
            Jake Dallimore Jake Dallimore
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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