limitations using Multilang filter

limitations using Multilang filter

by Yaniv Cohen -
Number of replies: 17

Using the Multilang filter requires an Html editor, thus only the question body can be filtered but not the answer options (for 'radio buttons', 'check boxes' and 'rate'), that have a simple text box as an editor.

Is there a way to use the filter without the html editor?

if not, is it possible to have an Html editor for the answer options box as well? 

Average of ratings: -
In reply to Yaniv Cohen

Re: limitations using Multilang filter

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Yaniv > is it possible to have an Html editor for the answer options box as well
This is potentially dangerous; those answer options should remain pure text.
Joseph
In reply to Joseph Rézeau

Re: limitations using Multilang filter

by Yaniv Cohen -

I just found out that it is possible to use HTML tags in the "possible answers" box.

For some reason the HTML tags of the multilang filter are not recognized.

For example:

<span lang="he" class="multilang">מילה בעברית</span><span lang="en" class="multilang">English string</span>

I would expect that this line will be rendered as "מילה בעברית" for the Hebrew language, and "English string" for the English language.

This works fine for the quiz module.

In reply to Yaniv Cohen

Re: limitations using Multilang filter

by Yaniv Cohen -
Anyone??
In reply to Yaniv Cohen

Re: limitations using Multilang filter

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers
Looks like the function "choice_values" that separates text from images is also stripping the multi-lang tags.

Entered in tracker as CONTRIB-1128.

mike
In reply to Mike Churchward

Re: limitations using Multilang filter

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers
This has been resolved and changes submitted.
In reply to Mike Churchward

Re: limitations using Multilang filter

by Yaniv Cohen -

Thanks Mike!

The Multilang text is now showing without the html tags when viewing the questionnaire (GOOD).

The problem is that the text is not filtered. all strings are showing no matter what language moodle is set to (BAD).

In question body, where text is entered to the html editor, the Multilang text is filtered o.k. and working just fine.

Maybe it's possible to make a limited html editor for the answers.

Lets say : fint size, bold, colors and Multilang box of course.

Thanks again !

Yaniv.

In reply to Yaniv Cohen

Re: limitations using Multilang filter

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Yaniv,

The multilang filter now works OK, since Mike's fix. However, since the HTML editor is not available to the "possible answers" field, you have to encode your filtered content "by hand". Here is an example, with English and French.

HTML contents of the Question text (obtained by using the Lang dropdown list in the HTML editor menu):

<span lang="en" class="multilang">What is your favorite drink?</span> <span lang="fr" class="multilang">Quelle est votre boisson préférée ?</span>

Possible answers (to be coded by hand)

<span lang="en" class="multilang">coffee</span><span lang="fr" class="multilang">café</span>

<span lang="en" class="multilang">beer</span><span lang="fr" class="multilang">bière</span>

<span lang="en" class="multilang">milk</span><span lang="fr" class="multilang">lait</span>

Attached shows the view screen with English or French as current language.

Joseph

PS.- There is however a display of both languages on the View all responses page. I will look into this problem now and find a fix.

In reply to Joseph Rézeau

Re: limitations using Multilang filter

by Yaniv Cohen -

Thanks Joseph,

It seems we're both right.

You checked the filtering with a "radio buttons" question, and it's working fine for that question type.

I cheked the filtering with the "rate quetion", and found that the text is not filtered for questions of that type.

Something is not working with filtering of rate quetions.

In reply to Yaniv Cohen

Re: limitations using Multilang filter

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Yaniv,
You are right. I have fixed this for the rate question type now and committed to CSV.
If you are in a hurry to test it, in file questiontypes.class.php, line 1235 change
echo '<td class="'.$bgr.'">'.$content.'&nbsp;</td>';
to
echo '<td class="'.$bgr.'">'.format_text($content, FORMAT_HTML).'&nbsp;</td>';

All the best,
Joseph
PS.- I am still working on the display problem in the View All responses screen.
In reply to Joseph Rézeau

Re: limitations using Multilang filter

by Yaniv Cohen -

Hi Joseph,

Filtering works great now, except for the "Title" and "Subtitle" fields that are not filtered.

Could you please fix that too.

Thank you!!

In reply to Yaniv Cohen

Re: limitations using Multilang filter

by Yaniv Cohen -

Hi Joseph,

Did you get a chance to look at that?

In reply to Yaniv Cohen

Re: limitations using Multilang filter

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Done and committed.
Joseph
In reply to Joseph Rézeau

Re: limitations using Multilang filter

by Yaniv Cohen -

Thanks!

The titles are filtered o.k now, but I think this change caused a different problem.

In editing mode I lost the ability to see all languages at once for the question body.

After I enter a multilang text in question body, it's being filtered in editing mode as well. So if I want to come back and edit an English string, I have to switch to english, and if I want to edit a Hebrew string I have to switch to Hebrew.

This is not how it used to be, and I think that it's not the way it should be.

In reply to Mike Churchward

Re: limitations using Multilang filter

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Mike,
Unfortunately your fix now triggers a new bug if the text of possible answers contains a word which is linked to a glossary entry!
I have re-opened CONTRIB-1128.
Joseph