Moodle FEE Docs
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Multilingual content

Moodle allows you to have multilingual content ready to be displayed to the user, depending on their settings. The original documentation in English is here.

The multilingual content filter allows you to create resources in multiple languages. When enabled, it looks for tags

    <span lang="xx" class="multilang">

that indicate that the text contains various languages. Then it selects and displays the text in the user’s language (as set in the browser or the user’s preferences).

How to create multilingual content

First, create content in multiple languages (in the same source) to use this feature. Then enclose each language block (or multilingual block) in the following tags:

    <span lang="cs" class="multilang">Text v češtině</span>
    <span lang="en" class="multilang">Text in English</span>
Important
Both elements should be close to each other.

For these tags to work when editing text in a text editor, it is necessary to be in code editing mode (for HTML editor, open the advanced menu (1.) and press </> (2.)) and then insert.

Where to find HTML editor
Where to find HTML editor

Otherwise, any titles or labels can be formatted using these tags directly in the text box.

Example of text formatting
Example of text formatting

The code must be inserted in the same element, e.g. the following code:

    <p><span lang="cs" class="multilang">Text v češtině</span></p>
    <p><span lang="en" class="multilang">Text in English</span></p>

is incorrect - each block is in a different element <p></p>. The correct format in this case would be as follows:

    <p><span lang="cs" class="multilang">Text v češtině</span>
    <span lang="en" class="multilang">Text in English</span></p>

If you have a problem displaying both or neither language versions on the page, the cause is a wrong code format.