maths / moodle-qtype_stack

Stack question type for Moodle
GNU General Public License v3.0
142 stars 149 forks source link

[[lang]] Block not working in general feedback #1162

Closed bgailer closed 7 months ago

bgailer commented 8 months ago

Hello,

when using the [[lang]] Block in our STACK questions, it works fine in the question text, the specific feedback or the PRT feedback. When using the [[lang]] Block inside the general feedback, however, only the English version of the text is displayed. Our STACK Version is 2023121100.

I found a closed thread in the moodle forum (https://moodle.org/mod/forum/discuss.php?d=444209) where the author has a similar problem. When importing the example question given in this thread into our Moodle, the text in the specific feedback gets translated, but the text in the general feedback does not. So it seems that the issue regarding the specific feedback has already been fixed (maybe in #1051) but the issue with the general feedback is still there.

aharjula commented 7 months ago

Well, this is annoying I thought it was there already.

So basically, the active language needs to be present when it gets rendered, i.e., this:

https://github.com/maths/moodle-qtype_stack/blob/545d87df14377401077d7baf693ab7909a97d721/question.php#L1162-L1167

Needs to also happen for the $session here:

https://github.com/maths/moodle-qtype_stack/blob/545d87df14377401077d7baf693ab7909a97d721/question.php#L607

Well, it seemed like it was still missing from the questiondescription as well...

In any case, note that only those languages that are used in the question-text will work in any of the parts of the question. So a quick test with only having [[lang]] blocks in the feedback will not work.

aharjula commented 7 months ago

Anyway, this should fix it.