Multi-Language Content (v2)
Maintained by
Iñigo Zendegi Urzelai, Iñaki Arenaza, Kepa Urzelai
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.
Comments
Product ratings and reviews are coming to Moodle Marketplace. Until then, existing comments remain available to read, but new posts have been disabled.
Great job, But I have a question, I have done some customization in course display. I mean, I added some code to display some messages or field values with my php script (with out following the plugin or moodle classes). Will this plugin also translate custom fields display which are appeared along with course information?
For example, can I use {mlang fr} within echo $SomeCustomField in side custom php code?
If not, what will be the possible way to deal with it, I have done a lot of customization due to changed requirements and with less given time. I did not do it by developing local plugin.
Thanks
Salman
I don't expect that the "beta" (or more appropriately "extended") version of the plugin will fall out-of-date. Given that the extended version is 85-90% of the same code as the standard one, and that I don't foresee the standard version changing a lot (unless Moodle core filtering code changes substantially), I would say there is little risk of falling out of date w.r.t the standard version.
Saludos.
Iñaki.
You provided me with a beta version of your plugin back in August. Before I begin using this beta version full-time, I was wondering if you expect that eventually it will fall out-of-date and I'll be left with an outdated/incompatible filter? I'm wanting to think long-term for this particular website/project so if there's any chance that I could get "stuck" later on, then I will most likely opt for a different solution.
Thank you,
JP
a couple of questions:
* Which version of Moodle is your site runnig? Also, which PHP version is your site using?
* Does any message appear in the error logs if you enable DEVELOPER mode in the debug settings?
I assume you have the plugin enabled and configured to apply not just to "normal content" but to headers and other types of content aswell.
What mistifies me is that it depends on the theme you are using, as the plugin doesn't care about themes at all (in fact, all the filtering is done independently of the theme).
Saludos.
Iñaki.
for some reason, the mlang-Tag is not interpreted on my site ... is it also depending on the theme I'm using?
Example: http://academy.seiko-eyewear.com/ on the frontside box "certificates"
Thanks for any help
Sascha
Wow, this is great. Thanks for taking the time to implement this feature into a beta version! I can confirm that it works perfectly for me
I totally understand and appreciate your goal to keep the filter as simple as possible. Since that is the case, I have one last question about future use and updates:
Since this beta version is technically not part of the stable version, if I decide to use the beta, do you expect that eventually it will fall out-of-date and I'll be left with an outdated/incompatible filter? I'm wanting to think long-term for this particular website/project so if there's any chance that I could get "stuck" later on, then I will most likely opt for a different solution.
Thank you,
JP
unfortunately, short of modifying the code, the only way to deal with it would be to treat "en" and "en_us" as two completely different languages and use an additional {mlang} tag.
As I don't expect core developers modifying core_string_manager_standard:: populate_parent_languages() and the en_us language pack any time soon, I've created a beta version of the filter_multilang2 plugin which allows you to specify more than one language for a single tab. With this beta version you can write something like:
{mlang en,en_us,en_kids}This will be shown for "en", "en_us" and "en_kids" languages{mlang}
You just need to write the languages you want to filter the string with, separated by commas.
While I've added quite a few unit tests and tested it pretty thoroughly, I'm still hesitant to release it as a new stable version. As I've said in the past, my goal is to make the behavior and the mechanics of the filter as explicit and simple as possible. So I'd like to keep "creeping featurism" [1] as low as possible.
If you want to give it a try, you can clone the "wip-master-langlist" branch of the plugin repository, or simply download it from
https://github.com/iarenaza/moodle-filter_multilang2/archive/wip-master-langlist.zip
Even if the name of the branch includes the "master" term, that version is compatible with all the currently supported Moodle versions.
[1] http://www.catb.org/jargon/html/C/creeping-featurism.html
Saludos.
Iñaki.
I see, thanks for the explaining that. Do you have any suggestions on how to work around this limitation? Or would you say our only option is to just treat "en" and "en_us" as completely different languages (in which case we'd just need an additional {mlang} tag)?
Thank you,
JP
I have just tested this, and it works provided certain conditions are met (note: this conditions are set by Moodle core code[1], not the plugin itself). The conditions (as of today) are:
* The language pack provides a parent language (which is not the case for the en_us language pack, as of today).
* _And_, the parent language is *not* 'en'.
So, as you can see, both Robert's scenario and yours fail on both conditions. I.e., en_us doesn't provide a parent language, but if it did and specified 'en' (I tried this too), it would also fail.
[1] See core_string_manager_standard::get_language_dependencies() PHPDoc comments, and core_string_manager_standard:: populate_parent_languages() code.
Saludos.
Iñaki.
Thanks for the wonderful plugin! I have a related situation to Robert's question. We want our site to be translatable between English and Spanish. However, we also have a good mix of users of which many will use "en" and many will use "en_us" language packs.
I just tried setting my profile to "en_us", while using the {mlang en} tag. Unfortunately, it didn't work (just displayed a blank page). I tried it the other way around as well (set my profile to "en" and used {mlang en_us} tag) but this also didn't work. I can confirm that if the tag matches (i.e., if my profile is set to "en" and I use the {mlang en} tag), then everything works perfectly (including when I also add the {mlang es} tag for Spanish).
Do you have any suggestions for how I can get the plugin to recognize parent languages? Or, perhaps there is some pre-existing Moodle setting I'm not aware of which I need to modify in order for this to work? If so, I'd love to hear about it! Any advice would be greatly appreciated.
Thank you,
JP
it should recognize parent languages (it uses core_string_manager_standard::get_language_dependencies(), that returns a list of all explicit parent languages for the given language, and checks for all of those too).
Saludos.
Iñaki.
the plugin actually works wonderfully in Moodle 3.1
Saludos.
Iñaki.