Page MenuHomePhabricator

Do not convert text marked as being in another language with a lang attribute
Open, MediumPublic

Description

Liangent had the idea to make LanguageConverter check for lang attributes in the page content, and disable conversion for those pieces of text, similar to how -{}- disables conversion.
This would avoid e.g. <span lang="ja">-{...}-</span> which is double work, certainly when extensions have to disable conversion.


Version: unspecified
Severity: normal

Details

Reference
bz37617

Related Objects

StatusSubtypeAssignedTask
In ProgressWinston_Sung
In ProgressWinston_Sung
OpenNone
StalledNone
ResolvedNone
OpenNone
OpenNone
StalledNone
OpenNone
OpenNone
OpenNone
Resolvedcscott
Invalid GWicke
Resolvedliangent
Resolvedthiemowmde
OpenNone
Resolvedcscott
Resolvedcscott
Resolved Elitre
Resolvedcscott
Resolvedcscott
Resolvedcscott
Resolvedcscott
Resolvedcscott
OpenNone
DuplicateBUG REPORTNone
Resolvedcscott
OpenNone
OpenNone
OpenNone
OpenNone
ResolvedBUG REPORTJgiannelos
OpenNone

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:25 AM
bzimport set Reference to bz37617.

In LanguageConverter::autoConvert, I see code snippet:

		// disable convert to variants between <code></code> tags
		$codefix = '<code>.+?<\/code>|';
		// disable convertsion of <script type="text/javascript"> ... </script>
		$scriptfix = '<script.*?>.*?<\/script>|';
		// disable conversion of <pre xxxx> ... </pre>
		$prefix = '<pre.*?>.*?<\/pre>|';

Maybe we want to replace these with a real parser, for easier implementation of the wanted feature in this bug.

Another way: I believe there're some HTML parsers inside wikitext parser, to remove harmful attribs. Maybe we can add some markNoConversion calls when it sees elements with other lang="".

Sure, I'll take this for now. If/when I write the parsoid language converter, it would be straightforward to fix this. Fixing it in PHP is harder...

Aklapper subscribed.

@cscott: Hi, I'm resetting the task assignee due to inactivity. Please feel free to reclaim this task if you plan to work on this - it would be welcome! Also see https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for more information - thanks!

Tacsipacsi subscribed.

Sure, I'll take this for now. If/when I write the parsoid language converter, it would be straightforward to fix this. Fixing it in PHP is harder...

The Parsoid language converter is happening (T43716), even though not very quickly.