## Tuesday, March 26, 2013

### Fixing Multi language support in Moodle

Last week I was asked by +Charles Matthews to review WM.UK upcoming Wikipedia tutoring system being developed on on the open source Moodle system.

I've been thinking of different option to better support Wikipedia coaching in different languages  I have been reviewing and testing Moodle in the last few weeks to that end.

I'm really interested in developing course ware for both English and Hebrew editions (as a start).

### Multilingual content

While Moddle is internationalized, support of multilingual content requires using a somewhat clumsy technique. One need to use html and store different languages content in top level div elements. Then you have to switch on Moodle's multilingual filter which can hide all the language version which are incompatible with the language selector's settings.

However due to a bug the the html editor mangles the html code and mangles the top level <span> element required.
 <span lang="XX" class="multilang">your_content_here</span>
<span lang="YY" class="multilang">your_content_in_other_language_here</span>

Luckily I found a patch in the forum - but it did not work. However it got me started hacking the filter and I was soon able to get it to work with more and more elements.

I thought I'd share the bug fix online in case someone is stuck with this. Once I figure how I'll send a patch to the Moodle dev team.

the fix is as follows - search and replace span with div
then replace in line 57 with:

this just tells the filter to also consider some extra attributes that certain Moodle module  (e.g. wiki) place into divs such as xml:lang="XX"

the change is that you need to use <div> elements as your top level tags: