Note: You are currently viewing documentation for Moodle 3.4. Up-to-date documentation for the latest stable version of Moodle is likely available here: Multi-language content filter.

Multi-language content filter: Difference between revisions

From MoodleDocs
No edit summary
Line 50: Line 50:
The [https://moodle.org/plugins/view.php?plugin=availability_language Restriction by language availability condition] is an additional plugin that makes it easy to show an English resource only to English users and an activity in French only to French speaking students.
The [https://moodle.org/plugins/view.php?plugin=availability_language Restriction by language availability condition] is an additional plugin that makes it easy to show an English resource only to English users and an activity in French only to French speaking students.


==The Multi-Language Content (v2) additional plugin and Multi-Language Content Atto plugin==
==The Multi-Language Content (v2) additional plugin and Multi-Language Content text editor plugins==
There is also an alternative multi-language content filter available called [https://moodle.org/plugins/filter_multilang2 Multi-language Content (v2)]. This plugin uses very simple non-HTML tags to mark multi-language blocks, and can be used together with the [https://moodle.org/plugins/atto_multilang2 Multi-Language Content Atto plugin] or the [https://github.com/iarenaza/moodle-tinymce_moodlelang2 Multi-Language Content TinyMCE plugin] to make it even easier to create multi-language content without using the HTML view mode
There is also an alternative multi-language content filter available called [https://moodle.org/plugins/filter_multilang2 Multi-language Content (v2)]. This plugin uses very simple non-HTML tags to mark multi-language blocks, and can be used together with the [https://moodle.org/plugins/atto_multilang2 Multi-Language Content Atto plugin] or the [https://github.com/iarenaza/moodle-tinymce_moodlelang2 Multi-Language Content TinyMCE plugin] to make it even easier to create multi-language content without using the HTML view mode



Revision as of 13:20, 28 January 2016

Displaying text in multiple languages

The multi-language content filter enables resources to be created in multiple languages. When turned on, it looks for <span lang="xx" class="multilang"> tags which indicate that a text contains multiple languages. Then it selects and outputs the text in the user's language (as set in their browser or in their preferences).

Enabling the multi-language content filter

An admin can enable the multi-language content filter as follows:

  1. Go to Site administration > Plugins > Filters > Manage filters and in the dropdown menu for multi-language content select 'On'.
  2. If headings are to be shown in multiple languages too, select 'Content and headings' in the 'Apply to' column. Note that this may affect site performance.

How to use in a course

To use this feature first create your contents in multiple languages (in the same resource). Then enclose each language block (aka multilang block) in the following tags:

      <span lang="XX" class="multilang">your_content_here</span>
      <span lang="YY" class="multilang">your_content_in_other_language_here</span>

It is essential to be in the code editing mode (press [<>] in the HTML editor), when you enter these tags for them to work. Only spaces, tabs and enters can be used between the individual languages in the multilang block.

How to use for assignment submission agreements

  1. With the filter enabled, go to Site administration > Plugins > Activity modules > Assignment > Assignment settings.
  2. In the submission statement, add (for example)
      <span lang="en" class="multilang">This assignment is my own work, except where I have acknowledged the use of the works of other people.</span>
<span lang="fr" class="multilang">Ce devoir est le fruit de mon travail personnel, sauf aux endroits où l'utilisation d'oeuvre d'autres auteurs est clairement indiquée.</span> 

How it works internally

  1. Filter first looks for multilang blocks in the text
  2. For each multilang block:
    • If there are texts in the currently active language, print them
    • Else, if there exists texts in the current parent language, print them
    • Else, print the first language found in the text
  3. Text outside of multilang blocks will be shown always

Common problems

  • The multilang filter is not enabled. It can be enabled by a site administrator in Settings > Site administration > Plugins > Filters > Manage filters.
  • Extra characters between language span tags - editor might add <br /> or other tags, please review the html in source view
  • If the course setting is "force" some language, you won't be able to change the displayed language.
  • Extra spaces in language span tag
  • The multilang filter does not work with the course short name! A course's short name is meant as a unique course identifier, so it does not use the multilang filter

The 'Restriction by language' additional plugin

Restriction by language

Language filters are great, but sometimes they can make your resources and activities very complex.

The Restriction by language availability condition is an additional plugin that makes it easy to show an English resource only to English users and an activity in French only to French speaking students.

The Multi-Language Content (v2) additional plugin and Multi-Language Content text editor plugins

There is also an alternative multi-language content filter available called Multi-language Content (v2). This plugin uses very simple non-HTML tags to mark multi-language blocks, and can be used together with the Multi-Language Content Atto plugin or the Multi-Language Content TinyMCE plugin to make it even easier to create multi-language content without using the HTML view mode

Any questions?

Please post in the Languages forum on moodle.org.

See also