Moodle allows you to prepare multilingual content that is displayed to the user depending on their language settings.
Multi-Language Content
Thanks to the new version of the Multi-Language Content module (v2), working with multilingual content is significantly simplified.
The multi-language content filter allows you to create content in multiple languages. If it is turned on, it looks for tags, for example:
{mlang cs} Text v češtině {mlang}
How to use multilingual content?
If you want to use this feature, first create the multilingual content (in the same resource).
Then enclose individual language blocks (so-called multilingual blocks) using tags in the format {mlang xx}…{mlang}, where “xx” represents the language code (e.g., cs, en, de, etc.).
Example:
{mlang cs} Text v češtině {mlang}
{mlang en} Text in English {mlang}
Text formatting example
Other titles or labels can be formatted using these tags directly in a plain text field.
Text formatting example
Unlike the older method, the new solution is more flexible and less demanding on formatting. It supports not only text, but also other types of content, such as images. At the same time, it is no longer necessary to switch to the code editing mode – content can be entered directly in the text field.
Text formatting example
Instructions for the old format
You can find the original English documentation here.
To use this feature in the old format, first create content in multiple languages (in the same resource). Then enclose each language block (or multilingual block) within the following tags:
<spanlang="cs"class="multilang">Text v češtině</span><spanlang="en"class="multilang">Text in English</span>
Important
Both elements should be right next to each other - there shouldn’t be any other element between them, see the example below.
For these tags to work when editing text in the text editor, it is necessary to switch to the code editing mode (in the menu Tools → Source code) and only then insert the text.
Where to find the HTML editor
Other titles or labels can be formatted using these tags directly in a plain text field.
Text formatting example
The code must be placed within the same element, i.e., e.g., the following code:
<p><spanlang="cs"class="multilang">Text v češtině</span></p><p><spanlang="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 the following:
<p><spanlang="cs"class="multilang">Text v češtině</span><spanlang="en"class="multilang">Text in English</span></p>
If you happen to see both language versions on the page at once, or neither of them, the cause is exactly this incorrect code format.