Multi-Language Content (v2)

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.
Price option: Free

Supports Moodle 2.8-5.2 See all versions
Latest release: 4 months ago
Installations: 5688
Downloads (last 90 days): 3154

Frankenstyle name: filter_multilang2
Filters

Comments

Product ratings and reviews are coming to Moodle Marketplace. Until then, existing comments remain available to read, but new posts have been disabled.

Hi Harley,
I'm not enterely sure what you want to achieve.
If what you want is having the section name text depend on the user browsing language (i.e., showing 'Unit 1' while browsing the course in English, 'Unité 1' while browsing it in Frenche and 'Unidad 1' when browsing it in Spanish), you need to do a couple of things:
* Enable the multilang2 filter and configure it to be applied to both "Content and headings" (the default is just "Content")
* Set the section name to "{mlang en}Unit1{mlang}{mlang fr}Unité 1{mlang}{mlang es}Unidad 1{mlang}" (without the quotes).
That should do it.
Saludos.
Iñaki.
Hi there,
How would you enable the Unit Section name to better utilize this filter?
For example:
If you have "Unit 1" as the Section name , and since it's not HTML encoded, "Unité 1" would be also be displayed as a part of the Section name if you have a English/French course.
Hopefully this make sense. Thank you so much!!
Kind Regards,
Harley
Hi Mihai,
I'm a bit late to the discussion, but my goal is to keep the filter as simple as possible. Even if it doesn't cover everyone's particular needs.
The ultimate goal is to make the behavior and the mechanics of the filter as explicit and simple as possible, so everybody knows how to use it and what to expect from it, without having to think about hidden/unintended side effects (like 'what text will be displayed if the user is browsing the content with a language that is not one of the tagged ones?' or 'will putting the language tags at this place break the HTML, and render it invalid or unusable for accessible browsers?')
Saludos.
Iñaki.
Hola Brandon,
por lo que he visto en la versión de desarrollo de Moodle (rama master, que en su momento se convertirá en 3.1) , no hay cambios en cuanto a la forma en la que trabajan los filtros (este plugin se simplemente un nuevo tipo de filtro).
Por lo que si no hay cambios en ese área, funcionará sin problemas.
Saludos.
Iñaki.
Hola Iñaki, gracias por tu filtro, y una sola pequeña pregunta: tengo planeado migrar mi sitio de 2.9.4+ a Moodle 3.1 en algun momento en el futuro y quisiera saber si funcionará en la nueva versión. Gracias
Brandon
Michael, thank you for your suggestions.
I will try to work on some courses with this plugin, it is very easy to use in combination with the attorney plugin. Maybe I just need to move away from the idea that if no other language is available than print the default one.
But it might take me some time.
Hi Mihai, here are my thoughts on your proposal.
In order to implement the feature you are requesting, there would also need to be a requirement in place to have at least one alternative language available - just like the multilang_second plugin. Otherwise there would be no way to determine if text in a particular language not wanted or is simply not available.
I can see two ways to move forward with this:
1) Request that this be a a feature added to the multilang_second plugin, where multiple languages are requirement for each set of tags.
...or...
2) Add the multi-language requirement feature to this plugin, in which case the optional feature you want could then also be added.
Of course there is always the third option of always making sure there are tags available for every language you want to display, even if it means putting English text in a non-English set of {mlang} tags.
There is also an accessibility issue to consider. The English text would have to be in a HTML container that has a lang="en" parameter so as to ensure that screen readers could properly pronounce the English text on non-English pages.
The simple way around this would be to also have another new tag called something like {olang en}text{olang} which would simply be replaced with text. You could then put this inside the {mlang en} tag without having to edit any HTML.
Together they would look like this:
{mlang en}{olang en}text{olang}{mlang}
I developed something like this as a separate plugin for my client at www.instruxmedia.com. Unfortunately they have not made it freely available in the plugins repository on moodle.org however you should feel free to contact them.
Either way, this would be an enhancement that could only be implemented if there is a mandatory condition to have at least 2 languages present.
Best regards,
Michael Milette
Hi Inaki, thank you for the great plugin. It also works perfectly with the ATTO plugin.
One clarification that is an issue for us as we have MOODLE in 7 different languages.
For us it would be very useful if when there is no content in the chosen display language to still print the the default site language which is English.
As I read from the description it was intended to do so however this is different from multilang_second or the original MOODLE multiple languages support.
Hi Inaki - Thanks for a really useful plugin. You may want to consider extending your examples (in the description field as suggested by David perhaps smile ) to include the fact that its not just text blocks your filter works with, but any content wrapped in them. Just tested with some sample content I had been using to demo my previous 'hack' of the core multilang filter (no longer needed, I'll just use this instead!). That content includes a whole block including an image, a couple of paragraphs and a video (different image and video for each language) and your filter wraps it all and works fine with the extended content, not just the text you identify in your definition. https://moodle.org/mod/forum/discuss.php?d=326138#p1315119
Again, thanks very much!

Thanks Iñaki for sharing this plugin with the Moodle community. I was able to successfully test it without issues. When reviewing the code, I spotted couple of places that could be improved - especially with regards to performance impact of the filter. Please see your tracker for details.

You could consider improving the plugin page here in the directory too. What about shortening the summary text to just a sentence or two, and moving all the useful information into the description field. I also think that plain text formatting does not look too good for that field - Markdown is my favourite smile

Said that and with the hope that raised issues will be fixed in a future update, you are cleared to land now. Welcome to the Plugins directory!