The multi-language content filter allows you to display the same content in multiple languages within a single resource or activity, enhancing accessibility for international users.
🌐 Displaying Text in Multiple Languages
When this filter is enabled, Moodle scans for text wrapped in special <span>
tags with lang
and multilang
attributes. Based on the user’s preferred language (set in their profile or browser), Moodle will display the matching language content.
🧩 How to Enable the Multi-language Filter
- Navigate to:
Site administration > Plugins > Filters > Manage filters
- Find Multi-language content in the list.
- From the dropdown, select “On” to activate the filter.
- To apply the filter to headings as well, select “Content and headings” in the Apply to column.
⚠️ Enabling the filter for headings may slightly impact site performance.
✍️ How to Use in Course Content
- While editing content (such as in a Label, Page, or Block), switch to HTML mode by clicking the
[<>]
icon.
- Wrap each language version of your content in
<span>
tags using the format:
<span lang="en" class="multilang">Your content in English</span>
<span lang="de" class="multilang">Ihr Inhalt auf Deutsch</span>
- Ensure that:
- Tags are placed without other HTML or visible text between them
- Only spaces, tabs, or newlines are allowed between language blocks
- You start with the parent language if your site uses a child language pack (e.g.,
en
before en_us
)
✅ Correct Example:
<span lang="en" class="multilang">Welcome to the course</span>
<span lang="es" class="multilang">Bienvenido al curso</span>
📄 Example for Assignment Submission Agreement
You can also use the multi-language filter in Moodle-wide settings like submission agreements.
- Go to:
Site administration > Plugins > Activity modules > Assignment > Assignment settings
- In the Submission statement field, add:
<span lang="en" class="multilang">This assignment is my own work...</span>
<span lang="fr" class="multilang">Ce devoir est le fruit de mon travail personnel...</span>
⚙️ How It Works (Behind the Scenes)
- Moodle scans the content for multilang blocks.
- For each block:
- If the user’s selected language matches a block → show that block.
- If not, but a matching parent language exists → show that.
- Otherwise → show the first block in the set.
- Text outside multilang blocks is always displayed.
📘 See also: Moodle Docs – Multi-language content filter