Filters: Multi-Language Content (v2)

filter_multilang2
Maintained by Picture of Iñaki ArenazaIñaki Arenaza
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.

Multi-Language Content (v2) 1.0.5

Release notes

To Install it manually

  • Unzip the plugin in the moodle .../filter/ directory.
  • Enable it from "Site Administration >> Plugins >> Filters >> Manage filters".

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}
  

where XX and YY are the Moodle short names for the language packs (i.e., en, fr, de, etc.)
- Test it (by changing your browsing language in Moodle).

How it works

  • Look for "lang blocks" in the code.
  • For each "lang 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, don't print any text inside the lang block.
  • Text outside of "lang blocks" will always be shown.

Definition of "lang block"

Is any text (including spaces, tabs, linefeeds or return characters) placed between '{mlang XX}' and '{mlang}' markers. You can not only put text inside "lang block", but also images, videos or external embedded content. For example, this is a valid "lang block":

{mlang es}
First paragraph of text. First paragraph of text. First paragraph of text.

Second paragraph of text. Second paragraph of text. Second paragraph of text.

((-- An image goes here --))

Third paragraph of text. Third paragraph of text. Third paragraph of text.

((-- A Youtube video goes here --))

Fourth paragraph of text. Fourth paragraph of text. Fourth paragraph of text.
{mlang}

One example in action

  • This text:
  {mlang en}Hello!{mlang}{mlang es}¡Hola!{mlang}
  This text is common for all languages because it's outside of all lang blocks.
  {mlang en}Bye!{mlang}{mlang it}Ciao!{mlang}
  
  • If the current language is English, it will print:
  Hello!
  This text is common for all languages because it's outside of all lang blocks.
  Bye!
  
  • If the current language is Spanish, it will print:
  ¡Hola!
  This text is common for all languages because it's outside of all lang blocks.
  

Notice the final 'Bye!' / 'Ciao!' is not printed. - If the current language is Italian, it will print:

  This text is common for all languages because it's outside of all lang blocks.
  Ciao!
  

Notice the leading 'Hello!' / '¡Hola!' is not printed.

Moodle 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5

Version information

Version build number
2016080700
Version release name
1.0.5
Maturity
Stable version
MD5 Sum
8eca68e4afd86bac17b61dd24d62a944
Supported software
Moodle 2.8, Moodle 2.9, Moodle 3.0, Moodle 3.1, Moodle 3.2, Moodle 3.3, Moodle 3.4, Moodle 3.5
  • This is the latest release for Moodle 2.8
  • This is the latest release for Moodle 2.9
  • This is the latest release for Moodle 3.0
  • This is the latest release for Moodle 3.1
  • This is the latest release for Moodle 3.2
  • This is the latest release for Moodle 3.3
  • The more recent release 1.0.1 (2018070401) exists for Moodle 3.4
  • The more recent release 1.0.1 (2018070401) exists for Moodle 3.5

Version control information

Version control system (VCS)
GIT
VCS repository URL

Default installation instructions for plugins of the type Filters

  1. Make sure you have all the required versions.
  2. Download and unpack the filter plugin.
  3. Place the folder (eg "myfilter") in the "filter" subdirectory.
  4. Visit http://yoursite.com/admin to finish the installation