How to create a true multi-lingual site in Moodle

Moodle has language packs for almost every language you can think of. This means that it will translate most (if not all) core wording on the site. What it won’t do however is translate your course content, unless you follow this clever little blog post.

Recently, I just finished building a multi-lingual Moodle site that toggles the language between English and Welsh, not just for core Moodle stuff, but also for course content, labels, quiz questions and EVERYTHING in between.

Here’s how it works.

The user selects their prefered language from their user profile, or from the language menu selector at the bottom of the page.

If the user selects Welsh (Cymraeg) then all the English text is replaced with Welsh text, and conversely if the user selects English, then all the Welsh text is replaced with English.

So how do we do it?

Simple. We use <span> tags in our labels, quizzes and all activities where we need both languages. See the example below:

<span class"multilang" lang="en">The Law</span>
<span class"multilang" lang="cy">Y gyfraith</span>

By wrapping our text inside the span class above you can define what text is shown if the user selects English and what is shown if the user selects Welsh. And that’s it, there no need for any special CSS or javascript. This is a core Moodle feature. Please note, I don’t speak Welsh, the text was translated for me beforehand.

What else can I apply this to:

Pretty much anything. You can apply it to images, so you can show different images depending on the language. You can apply it to topic sections names, dropdowns, menus, chunks of text, quiz questions, answers and feedback.

Our English banner used on the Dashboard

Once you get your head around it, you can do lots of exciting things with this. It helps if you speak the language of the site you are translating, but I didn’t and it wasn’t too tricky.

Our Welsh banner used on the Dashboard

Happy translating!