multilanguage span tags

multilanguage span tags

by Rosario Carcò -
Number of replies: 43

I just installed a Moodle 2.03 test server and I am facing the problem that in news-posts I can no longer use complex hmtl-tags inbetween the <span lang="en" class="multilang"> tags.

This worked fine in 1.9.x and I am copying an example that works fine on my production server.

I just read on the docs that you may use only

>>Only spaces, tabs and enters can be used between the individual languages in the multilang block

But this was not true for 1.9.x Have a look at my production server: https://moodle.fhnw.ch/mod/forum/discuss.php?d=13885 where I can nest <ol><ul></ul></ol> Tags between the language span tags.

So this works fine

<span lang="de" class="multilang">

Deutscher Text.

</span>

<span lang="en" class="multilang">

English Text.

</span>

But as soon as I add any other tag, the html-code gets messed up. I am working without html-editor. Like this:

<span lang="de" class="multilang">
</span><p>
Deutscher Text.
</p>

<span lang="en" class="multilang">
</span><p>
English Text.
</p>

Hence the mulitlanguage display does not work any more.

Any Ideas? Rosario

Average of ratings: -
In reply to Rosario Carcò

Re: multilanguage span tags

by Marco Michelini -

Hi Rosario,
I have the same problem for standard resources such as labels and others activity, because the use of "span" tag is not very simple for users that don't know the html language.
So, for my website I used a solution that works fine, for my purpose, also if I don't know if it is the best solution.
You can find my solution in this forum:

http://moodle.org/mod/forum/discuss.php?d=175008

I don't know if it is helpful for you but, for example, you can use a course with multilanguage sections and insert one forum for every language in each section.
So, your users can insert in simple mode posts without the use of "span" tags.

In my case I have only 2 languages.
But you can modify my code to implement a system with more languages.
For example, with some like this (but you must try and check if it works):

if ( ($showsection and ($section % 5 == 0) and current_language() == 'de') or ($showsection and ($section % 5 == 1) and current_language() == 'en') or ($showsection and ($section % 5 == 2) and current_language() == 'es') or ($showsection and ($section % 5 == 3) and current_language() == 'fr') or ($showsection and ($section % 5 == 4) and current_language() == 'it') ) {
...

The result of "$section % 5" is the rest of the division of $section for 5.

In this mode, sections 0, 5, 10 and multiple of 5 are visible in Deutsch.
Sections 1, 6, 11, ... are visible in English.
Sections 2, 7, 12, ... are visible in Espanol.
Sections 3, 8, 13, ... are visible in Francais.
Sections 4, 9, 14, ... are visible in Italiano.

I hope that in the future the Moodle community implement a useful solution to solve the problem of the multilanguage resources that are insertable in simple mode.
The "span" tag is useful in some case, but not in other.

Bye,
Marco

Average of ratings: Useful (1)
In reply to Marco Michelini

Re: multilanguage span tags

by Rosario Carcò -

Ciao Marco, avevo già visto i tuoi contributi a proposito.

As I said, the html-parser in 1.9.x does not touch my complex forum posts with mutlilanguage <span> tags. But in 2.x it changes my source to the example shown above, I think when parsing and storing the text I type in. So the multilanguage filter is not the problem I think but the html-parser before it stores everything. WHY is my source modified??

Of course your code-snippet is a good way to handle things on a larger scale. But it must be a bug if something does not work as it used to work in 1.9.x

If this is worth a tracker-issue, and you experience the same misbehaviour, I will post it there.

Rosario

In reply to Rosario Carcò

Re: multilanguage span tags

by Rosario Carcò -

I need some help on this because our site has to run in german and english and so it did until now in 1.9.12 but 2.03+ does not. All of our news have to be in both languages.

Thanks a lot, Rosario

In reply to Rosario Carcò

Re: multilanguage span tags

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

Hi Rosario. The implementation of this feature has not changed between 1.9 and 2.0. I believe the lack of the legacy behaviour is caused by a different setting of your 2.0 site.

The reason of your problem is that the code you use is not valid XHTML. Inline element <span> can't contain any nested block elements like <p>. Therefore the HTMLpurifier (a library that Moodle uses for cleaning the output) modifies the code to make it valid - which in turn breaks the multilang filter syntax.

What I believe is that in your 1.9 site, the HTMLpurifier was not enabled as it used to be an experimental feature for PHP5 servers only that had to be enabled explicitly. In Moodle 2.0, it is enabled by default unless you turn it off.

The only solution I can see for you at the moment is to disable HTMLpurifier. That is definitely not an optimal choice from other points of view but until someone writes a new multilang filter that supports nested block elements, there is probably no other way ho to achieve what you describe.

Hope this helps.

Average of ratings: Useful (2)
In reply to David Mudrák

Re: multilanguage span tags

by Rosario Carcò -

Thanks a lot David, I found the setting on 1.9 in the experimental section but I do not see how to disable it in Moodle 2.x. If there is not a GUI option to set, how could I disable it?

Rosario

In reply to Rosario Carcò

Re: multilanguage span tags

by Rosario Carcò -

I found a hint to the config table where you can find an entry with name enablehtmlpurifier. I set it to 0 directly with phpMyAdmin.

And now my news items show up correctly with title and content in multilanguage.

You made my day and as soon as the problems with the new file system in Moodle 2. progress, I can think about porting our 1.9 production server to Moodle 2.x next winter or spring, I guess.

Rosario

In reply to Rosario Carcò

Re: multilanguage span tags

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
If you searched in admin tree, you would find it at Site administration > Security > Site policies. I'm glad it helped.
In reply to David Mudrák

Re: multilanguage span tags

by Rosario Carcò -

David, you are very right, I must have missed this setting. And for all those "blind" like me, here the screenshot.

moodle2HTMLpurifierSetting

Rosario

Average of ratings: Useful (1)
In reply to Rosario Carcò

Re: multilanguage span tags

by Zdeněk Hurák -

I just wanted to voice the same trouble with multilanguate support in Moodle 2.0, including the experienced change in behaviour when switching from 1.9 do 2.0. I run a bilingual course and David Mudrák's advice (disabling HTML Purifier) saved me too.

In reply to Zdeněk Hurák

Re: multilanguage span tags

by Marco Michelini -

Hi,
I have the latest version of Moodle (2.03+, Build: 20110719) with HTML purifier disabled and when I use this code:

<span class="multilang" lang="it">Testo in italiano</span>
<span class="multilang" lang="en">English text</span>

it works fine.
But if I try to use TinyMCE HTML editor to formatting text, there are problems.
For example, if I insert bold for the word "Testo in italiano" and italic for "English text", the multilanguage filter don't works and the html code is modified to:

<p><strong><span class="multilang" lang="it">Testo in italiano</span></strong> <em><span class="multilang" lang="en">English text</span></em></p>

If I manually modify this code as bottom:

<p><span class="multilang" lang="it"><strong>Testo in italiano</strong></span> <span class="multilang" lang="en"><em>English text</em></span></p>

the multilanguage filter works again.
I think that before the "<span>" tag of the multilanguage filter and after the "</span>" tag of the multilanguage filter we must not insert tags, otherwise the multilanguage filter don't works.
But if I use the TinyMCE HTML editor for formatting text, such tags are automatically inserted and the multilanguage filter don't works.

Other example: if I modify the color to the text "Testo in italiano", the multilanguage filter don't works again and the code is modified to:

<p><span style="color: #ff0000;" class="multilang" lang="it"><strong>Testo in italiano</strong></span> <span class="multilang" lang="en"><em>English text</em></span></p>

In this case the color style is automatically inserted within the span tag of the multilanguage filter.
Perhaps, this depend from the text that we select with the TinyMCE HTML editor.

This is only a problem of my Moodle configuration or is a general problem?

Thanks a lot,
Marco Michelini

In reply to Marco Michelini

Re: multilanguage span tags

by Rosario Carcò -

Marco, when I edit multilanguage strings I NEVER use htmlEditors I use plain text/standard web forms in my Moodle-Profile. Just because you never know what those editors  do with your custom tags.

Saluti dalla Svizzera, Rosario

In reply to Rosario Carcò

Re: multilanguage span tags

by Massimo Eccli -

Rosario buona sera, anche io ho gli stessi problemi, ma con un'altra lingua, il russo. Ho caricato tutte e due el lingue (italiano e russo) e fin qui tutto è filato liscio come l'olio, quindi io vedo sia la pagina in cirillico che in italiano. Quando devo però creare un corso con i caratteri cirillici, qui inizia il problema e mi dice infatti "errore di lettura del database". Che cosa devo fare? Non dico che sono disperato, ma quasi.

Attendo sue notizie.

In reply to Massimo Eccli

Re: multilanguage span tags

by Rosario Carcò -

Caro Massimo, scusa se rispondo soltanto adesso, dopo i tanti lavori d'inizio semestre/anno accademico alla nostra Università e dopo un paio di settimane di vacanze passate in Sicilia dai miei genitori.

I developed a myCourses and siteNavigation block, you can find in these threads. And unfortunately there is no way, as far as I know, to use the language Tags also in the course fullname and shortname fields and neither in the category names. I think this could be because the shortname of a course is a unique string the table is indexed on. But I would have to make some tests myself because I do not remember exactly the case a user reported to me when using my blocks.

So I hope you have set your tables to utf-8 anyway. But I do not know whether for cirillic characters utf-8 is enough or if you need rather utf-16 or more.

Rosario

In reply to Rosario Carcò

Re: multilanguage span tags

by Marco Michelini -

Hello Rosario,

Yes I know that it is better use plain text editor.

But the problem is for my users that don't know the html language.

The use of a simple html editor would be the best choise.

Thank you.

Tanti saluti anche a te.

Ti rispondo solo ora perché la notifica mi era finita in mezzo alla miriade di mail arrivatemi questa estate e che sono riuscito a smaltire solo ora.

Marco Michelini

In reply to Rosario Carcò

Re: multilanguage span tags

by Rosario Carcò -

Incredible, in Moodle 2.3.1 it has disappeared from there and my multilanguage tags do not work any more in my site-latest-news. I will have to check this again tomorrow.

Rosario

In reply to Rosario Carcò

Re: multilanguage span tags

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

@Rosario "Incredible, in Moodle 2.3.1 it has disappeared from there ..."

In a long discussion like this, spreading over a year, when you post a new message, it is not a good idea to use such ambiguous references as "it" and "there". What has disappeared from where?

You should really be more explicit.wink

Joseph

In reply to Joseph Rézeau

Re: multilanguage span tags

by Rosario Carcò -

I am sorry Joseph, I thought you simply click on SHOW PARENT to see the post referenced. An there is a neat screen-shot to show "it" and "from there".

Anyway, I just discovered that now you have to enable TRUSTED CONTENT, still in SECURITY->SITEPOLICIES to be able to use nested tags inside the language span-tags.

Rosario

In reply to Rosario Carcò

Re: multilanguage span tags

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Rosario,

In all those years of using Moodle and its forum it had never occurred to me to do that (clik on SHOW PARENT).blush Many thanks for pointing me to this feature. One learns every day!

Joseph

In reply to Joseph Rézeau

Re: multilanguage span tags

by Rosario Carcò -

Joseph, I am with you, if you look at how I misinterpreted SERVER FILES in one of those threads where we talk about the new file and repository system... I learn every day. I just finished my uploadusersandcourses.php for Moodle 2 if you are interested in automating course creation and user enrolment. Simply search for it. And I will start recoding my sitenavigation/mycourses as soon as possible.

Rosario

In reply to Rosario Carcò

Re: multilanguage span tags

by Fai Wong -

I found that there are some rules for multilanguage.

1)      cannot include<p> or </p>, use <br />

2)      cannot have 2 span for the same language

<span class="multilang" lang="zh_tw">

However, I find that we may "reset" it by have one "empty span". (i.e. <span></span>

3)      cannot add anything in the <span class="multilang" lang="zh_tw"> but you can include another <span>.

eg. <span class="multilang" lang="zh_tw" style="font-size: medium; color: #0000ff;"><strong>Chinese</strong></span>

change to

<span class="multilang" lang="zh_tw"><span style="font-size: medium; color: #0000ff;"><strong>Chinese</strong></span></span>

If I am wrong, please let me know.

Regards

 

In reply to Fai Wong

Re: multilanguage span tags

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

Those are known limitations of the current multilang filter. It was actually designed to support just short texts without HTML, not full blocks of HTML text. You can't include the block element P inside the inline element SPAN as that is not valid HTML. And even the example 3) in your post is tricky because the filter actually stops at the first closing tag while it should do it at the second.

There is a proposal for an improved version of the filter somewhere in the tracker that goes around these limitations.

Average of ratings: Useful (1)
In reply to David Mudrák

Re: multilanguage span tags

by Evan Donovan -

If the multi-language filter was only intended for short spans of text, is there currently a way to handle long blocks of text with inline formatting.

Where is this proposal in the tracker so that I may follow it?

Note that for me, the filter doesn't work when I disable HTML Purifier but it does work when I keep it enabled. I am using Moodle 2.0.

In reply to Evan Donovan

Re: multilanguage span tags

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

Hmm, I tried to find it and I failed... Anyway, the idea is pretty simple. The point is that instead of using some HTML pair tags to mark the borders of the multilang block (it is impossible to process it in clean regex without an actual DOM construction), two unpaired empty span tags would be used. As an example:

<span class="multilangwrapper-start" />
    <span class="multilangblock-start multilang-en" />
        <h1>Note that you can have anything here now</h1><p>and it is valid</p>
    <span class="multilangblock-end multilang-en" />
    <span class="multilangblock-start multilang-cs" />
        <h3>Even completely different HTML structure for different languages</h3>
    <span class="multilangblock-end multilang-cs" />
<span class="multilangwrapper-end" />

There were some details left to think about yet (like what should be displayed when the page is view in a language that does not have its own block etc) but I believe this is the way to go.

In reply to Rosario Carcò

Re: multilanguage span tags

by Rosario Carcò -

Sorry, in Version 2.3 it seems not to function any more again. And the HTML-Purifier option has gone and possibly has been replaced by the enable trustcontent capability:

moodleEnableTrustedContent

Still the texts I type in are replaced with a lot of backslashes, even the multilanguage tag itself:

 <span lang=\"de\" class=\"multilang\">

Any hints? I still need multilanguage support for our Moodle site. Rosario

In reply to Rosario Carcò

Re: multilanguage span tags

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Ciao Rosario,
I've not still played enough with 2.3 to give you a specific hint but... did you check the PHP configuration for any magic_quotes* setting change in the deploy after the initial 2.3 installation?

HTH,
Matteo

In reply to Matteo Scaramuccia

Re: multilanguage span tags

by Rosario Carcò -

Ciao Matteo,

I just verified and compared with php.ini settings on my prduction server:

; Magic quotes

; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = On

; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
magic_quotes_runtime = Off

; Use Sybase-style magic quotes (escape ' with '' instead of \').
magic_quotes_sybase = Off

They seem to be indentical. Any other option fooling me? Rosario

In reply to Matteo Scaramuccia

Re: multilanguage span tags

by Rosario Carcò -

OK, it must be turned OFF as I use PHP 5.3.8 on that test-server. On the production server with PHP 5.2.14 it works well with ON with Moodle 1.9 and Moodle 2.07

; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = Off

Hope this will help also others to tune their PHP 5.3, Rosario

In reply to Rosario Carcò

Re: multilanguage span tags

by Rosario Carcò -

I discovered that enable trustedContent is still not necessary, but do not forget to enable the multilanguage Filter in Plugins/Filters.

In reply to Rosario Carcò

Re: multilanguage span tags

by Rosario Carcò -

OOoh, what a mess, in Moodle 2.3.1 the HTML-Purifier setting has disappeared and now ENABLE-TRUSTED-CONTENT has to be enabled. Otherwise nested tags inside the span-tags are messed up as soon as you save your text.

Rosario

In reply to Rosario Carcò

Re: multilanguage span tags

by Sebastien M. -
It appears the the purifier is not called constantly everywhere in a Moodle installation. I imagine that Enable-trusted content may help on some occasions but in my case it is dramatically failing in my multilang glossaries (both for input and output of data). Therefore I disabled the purifier completely (see below) while a permanent and more stable solution is suggested by Moodle HQ.

For the sake of debugging, please describe here how to reproduce what you are seeing and maybe file a bug report if you have not done so already.

Regards,
In reply to Sebastien M.

Re: multilanguage span tags

by Rosario Carcò -

Simply look at my first posts in this thread. I am only interested in using span-language tags in TITLES of news-posts, in content of news-posts, in category names and description, in HTML-fields wherever they appear, so as to present those contents in the language, the logged in user chose.

In reply to Rosario Carcò

Re: multilanguage span tags

by Constantin Kioulafas -

Hi guys,

I have been using moodle for a very short time, and had come up against the problem of providing multi-language content. I'd found a couple of references to enclosing content within formatted span tags for each language, but this kept getting filtered out. I had not found a lot of references to this problem and until now, no solutions.

I am using moodle version 2.2.2

The reason for the filtering of the span tag, has to do with the xhtml standard, which does not allow block tags (such as paragraphs <p>) to be inside a span section. Block tags are however allowed inside divs.

What I've done, is edited the file filter/multilang/filter.php and changed the following:

$search = '/(<span(\s+lang="[a-zA-Z0-9_-]+"|\s+class="multilang"){2}\s*>.*?<\/span>)(\s*<span(\s+lang="[a-zA-Z0-9_-]+"|\s+class="multilang"){2}\s*>.*?<\/span>)+/is';
} else {
// old syntax
$search = '/(<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.*?<\/(?:lang|span)>)(\s*<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.*?<\/(?:lang|span)>)+/is';
}

to

$search = '/(<(?:div|span)(\s+lang="[a-zA-Z0-9_-]+"|\s+class="multilang"){2}\s*>.*?<\/(?:div|span)>)(\s*<(?:div|span)(\s+lang="[a-zA-Z0-9_-]+"|\s+class="multilang"){2}\s*>.*?<\/(?:div|span)>)+/is';
} else {
// old syntax
$search = '/(<(?:lang|div|span) lang="[a-zA-Z0-9_-]*".*?>.*?<\/(?:lang|div|span)>)(\s*<(?:lang|div|span) lang="[a-zA-Z0-9_-]*".*?>.*?<\/(?:lang|div|span)>)+/is';
}

 

AND

$searchtosplit = '/<(?:lang|span)[^>]+lang="([a-zA-Z0-9_-]+)"[^>]*>(.*?)<\/(?:lang|span)>/is';

to

$searchtosplit = '/<(?:lang|div|span)[^>]+lang="([a-zA-Z0-9_-]+)"[^>]*>(.*?)<\/(?:lang|div|span)>/is';

These changes now allow me to use the div as well as the span tag. I generally use span in single line input fields such as Course Names, and div for the mulitline textareas such as descriptions. 

I've not tested it extensively, but it has worked for any content I have translated into more than one laguage so far. Hope this can be of help to anyone else.

Average of ratings: Useful (1)
In reply to Constantin Kioulafas

Re: multilanguage span tags

by Vanyo Georgiev -

I found a problem with this solution.

When the text inside <div> blocks is formated by <span> elements, it is breaked at the first closing </span>.

So I suggest a slightly different solution here.

In reply to Rosario Carcò

Re: multilanguage span tags

by Sebastien M. -
Hello everyone,

I am currently upgrading multiple multilang moodle installations from the 1.x branch to the 2.3 branch and I too am confronted with the HTML purifier issue. Since 2004, multilang moodle administrators were invited to use the <lang> tag and later the <span …> tags to mark their multilang content. Contrary to what is mentioned earlier in this thread, this solution was a sitewide solution for all content and not limited to short content like labels.  However, from what I can see in the 2.3 code, most html content today is purified and this change is definitely susceptible to break multilang installations.

As an interim solution, my quick fix is to simply disable the htmlpurifier on a site wide basis (see code below). This should not impact seriously XHTML compliance for the site because the content outputted is filtered by the multilang filter so there should be no nested tags in the <span> lang tag.

As a permanent solution for any outputted content, I recommend that any cleaning for be performed after the multilang filter has parsed the content. Regarding the content presented in moodle forms for content editing (e.g. editing multilang glossary entries), no cleaning should be performed for loading the content in the forms.

While I look forward to hearing your thoughts on this very important issue (perhaps on a dedicated thread), here is the quick fix to disable the purifier:


------------- QUICK FIX ------------------
In the file moodle/lib/weblib.php, edit the function clean_text as follow:

FIND:
function clean_text($text, $format = FORMAT_HTML, $options = array()) {
    $text = (string)$text;
ADD:
return $text; # bypass htmlpurifier for non XHTML compliant multilang moodle installations
------------------------------------------------


/Sebastien
In reply to Sebastien M.

Re: multilanguage span tags

by Constantin Kioulafas -

Hi Sebastian,

I've got to say I am amazed at the number of people who resort to bypassing the issue rather than fixing it. To simply disable the html purifier is asking for trouble. There's a good reason the developers put it in, including filtering out any malicious code.

I admit to being a novice when it comes to moodle, but as I see it, the problem is that at the moment the way you distinguish the different language blocks is by enclosing your text in specially formatted spans, one for each languge, <span lang="en" class="multilang">....</span><span lang="de" class="multilang">....</span>

The problem with span is that it cannot enclose block tags such as <p>...</p>, it would constitute invalid html. The solution to this is to include the <div> tag as an alternative to using <span>, which will happily enclose any other type of block tags and would remain valid html. The code that does the parsing is in the file filter/multilang/filter.php, where regular expressions currently filter out anything but the span tag for use in the language blocks. All that needs to be done is to add the div element to this (see my post directly above yours).

Adding the div tag is the correct solution, removing the html purifier is a dangerous solution.

Regards

In reply to Constantin Kioulafas

Re: multilanguage span tags

by Sebastien M. -
Hi Constantin,

When it comes to regression bugs threatening the stability of live/production sites (new features or bug fixes breaking past standards of a community), bypassing the problem is not that bad of an interim solution (I manage all my moodle sites so I do not fear malicious code). Moreover, the changes you suggest to the multilang filter entail an irreversible global change throughout all current production databases (change <lang> tags to <div> tags). At this point, your proposal is as valid as mine until Moodle HQ decides what to do with it: Either they change the multilang markers (to whatever sgml tag since the code is filtered anyway before being outputted!)  or they change the filtering order for outputted content and leave unchanged the content loaded in moodle editing forms.

By looking at the code and based on my 8 years experience with multilang moodle installations (since distro 1.4), my understanding is that multilang issues are not a priority for Moodle HQ (many core plugins don’t support this feature anyway, e.g. glossary, rte). Maybe our proposals will help others and hopefully a core developer will browse through this forum and decide/find a solution.

Cheers,

Seb
In reply to Rosario Carcò

Enabling the "lang" attribute for the tag

by Sebastien Jaffredo -

Same situation for me here : in the process of upgrading a bilingual (French-Japanese) site from 1.9 to 2.3, I realise I cannot insert bilingual text anymore.

It seems to me the best solution is to enable the multilanguage filter to read "lang" attributes in a <div> tag (besides <span>). It appears this has already been resolved in this issue in the tracker (http://tracker.moodle.org/browse/MDL-32257).

I tried inserting that code into my filter/multilang/filter.php file and it worked perfectly.  Anybody with the same problem should try this fix and vote for this issue to make sure it is included in future versions.

In reply to Sebastien Jaffredo

Re: Enabling the "lang" attribute for the tag

by Sebastien M. -
Good luck with nested divs...
In reply to Sebastien M.

Re: Enabling the "lang" attribute for the tag

by Maiquel Sampaio de Melo -
Good point Sebastien. What do you think if we continue using the old tag 'lang'? I have successfully used it with Moodle 2.2 without having to touch the source code, by just changing the config.php to define the setting: filter_multilang_force_old = true; The 'lang' tag seems to be a reasonable container for this purpose because it guarantees backward compatibility, it can be used with TinyMCE and it doesn't require any change to the multilanguage filter source code.
In reply to Maiquel Sampaio de Melo

Re: Enabling the "lang" attribute for the tag

by Sebastien M. -
I agree with the old lang tag (I don't remember why it was abandoned in the first place somewhere in 2007). The problem is with existing websites.. Can we use mixed lang tags? I don't think so. So one must think of a script to convert span lang tags eventually in order to revert current multilang website the old way.... This is not an easy task...

Alternatively, as mentioned earlier in this thread, if the purifier can parse the content after the multilang filter than all our problems would be solved (for output anyway as I don't think there is a real problem to input nested span tags in a multilang context).