插件过滤器稳定版

Multi-Language Content (v2)

filter_multilang2Iñigo Zendegi Urzelai

  • Moodle 4.1–5.3
  • 更新 2026-04-19

This filter is a greatly simplified multi-language filter. It uses very simple non-HTML tags to mark multi-language blocks. Namely {mlang XX} {mlang} pairs, where XX is the Moodle short name for the language pack (i.e., en, fr, eu, es, es_mx, etc.)
It uses the same tags as the filter_multilangsecond plugin (to be compatible with it), but there is one difference between the two. This filter allows standalone {mlang} tags that don’t require adjoining alternative language tags. This makes the filter more flexible at the cost of potentially producing empty sets of tags.
To Install it manually
Unzip the plugin in the moodle …/filter/ directory.
To Enable it
Go to “Site Administration >> Plugins >> Filters >> Manage filters” and enable the plugin there.
To Use it
Create your contents in multiple languages.
Enclose every language content between {mlang NN} and {mlang} tags:
{mlang XX}content in language XX{mlang}
{mlang YY}content in language YY{mlang}
{mlang other}content for other languages{mlang}
where XX and YY are the Moodle short names for the language packs (i.e., en, fr, de, etc.) or the special language name ‘other’.
Version 1.1.1 and later: a new enhanced syntax to be able to specify multiple languages for a single tag is now available. Just specify the list of the languages separated by commas:
{mlang XX,YY,ZZ}Text displayed if current lang is XX, YY or ZZ, or one of their parent laguages.{mlang}
Test it (by changing your browsing language in Moodle).
How it works
Look for “lang blocks” in the text to be filtered.
For each “lang block”:
If there are texts in the currently active language, print them.

返回插件目录