Page MenuHomePhabricator

VisualEditor: avoid causing "Translation unit markers in unexpected position" edit abort
Open, MediumPublic

Details

Reference
bz65653

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:15 AM
bzimport set Reference to bz65653.

(In reply to James Forrester from comment #0)

"Translation unit markers in unexpected position." can just go die in Hell.
Gah.

Is this bug related to other bugs?

(In reply to Nemo from comment #1)

(In reply to James Forrester from comment #0)

"Translation unit markers in unexpected position." can just go die in Hell.
Gah.

Is this bug related to other bugs?

I don't know. You're the Translate extension expert. :-)

(In reply to James Forrester from comment #2)

I don't know. You're the Translate extension expert. :-)

Ok. That error probably just means that some newline was inserted in the wrong place before or after <!--T:1--> and similar, IIRC.

So if you don't have a specific intention here I guess this is one bug of the series "make VisualEditor not touch Translate stuff which otherwise breaks" (bug 56451, bug 71730), and is probably blocked on bug 48891 as its friends.

(In reply to Nemo from comment #3)

(In reply to James Forrester from comment #2)

I don't know. You're the Translate extension expert. :-)

Ok. That error probably just means that some newline was inserted in the
wrong place before or after <!--T:1--> and similar, IIRC.

So if you don't have a specific intention here I guess this is one bug of
the series "make VisualEditor not touch Translate stuff which otherwise
breaks" (bug 56451, bug 71730), and is probably blocked on bug 48891 as its
friends.

No, this is not a parser bug.

It's just a "VE should react to stupidly vague error responses by killing stupid comments in stupid places used by a stupid extension to do critical functions that should be done better" bug. :-)

I guess it can also be put that way. :) Does this new summary reflect the aim?

(In reply to Nemo from comment #5)

I guess it can also be put that way. :) Does this new summary reflect the
aim?

Not really. Putting a hack into VisualEditor to cope with another extension's model is not good. Either way, I don't care enough. :-)

Aklapper set Security to None.

With WikitextEditor this has become critical for editing translated pages.

With WikitextEditor this has become critical for editing translated pages.

Can you give me some more details on what the problem is, and what the steps to reproduce are?

Can you give me some more details on what the problem is, and what the steps to reproduce are?

Open a translatable page for editing, do an innocent change, get useless error report.
E.g. I'm trying to save https://www.mediawiki.org/w/index.php?title=Manual:Developing_extensions&oldid=2696554 with this diff:

--- 1.txt	2018-01-19 18:12:32.130524437 -0800
+++ 2.txt	2018-01-19 18:13:50.941714520 -0800
@@ -479,11 +479,11 @@
 
 <translate>
 
-==Support other core versions== <!--T:286-->
+==Support other core versions== <!--T:286--></translate>
 <!-- keep this in sync with [[Compatibility#MediaWiki_extensions]] -->
 
-<!--T:315-->
-There are two widespread conventions for supporting older versions of MediaWiki core:</translate>
+<translate>
+<!--T:315-->There are two widespread conventions for supporting older versions of MediaWiki core:</translate>
 
 <translate><!--T:316--> * Master: the master branch of the extension is compatible with as many old versions of core as possible. This results in a maintenance burden (backwards-compatibility hacks need to be kept around for a long time, and changes to the extension need to be tested with several versions of MediaWiki), but sites running old MediaWiki versions benefit from functionality recently added to the extension.</translate>
 <translate><!--T:317--> * Release branches: release branches of the extension are compatible with matching branches of core, e.g. sites using MediaWiki 1.27 need to use the REL1_27 branch of the extension. (For extensions hosted on [[gerrit]], these branches are automatically created when new versions of MediaWiki are released.) This results in cleaner code and faster development but users on old core versions do not benefit from bugfixes and new features unless they are backported manually.</translate>

(That is, break up the flow of translatable text with an untranslatable comment. None of the translation items are changed.)

I've tried a handful of different positions for the translate tag, to no avail.

(FWIW this is in new wikitext editor, not normal VE. I don't imagine it makes any difference.)

Also results in a bunch of JS errors along the line of

Uncaught TypeError: Cannot read property 'top' of null
    at <anonymous>:405:348
    at Array.forEach (<anonymous>)
    at VeUiDiffElement.ve.ui.DiffElement.positionDescriptions (<anonymous>:405:25)
    at <anonymous>:682:225
    at VeUiMwSaveDialog.OO.ui.Window.withoutSizeTransitions (<anonymous>:45:1)
    at <anonymous>:682:129

and

Uncaught TypeError: Cannot read property 'getSelection' of undefined
    at VeUiFindAndReplaceDialog.ve.ui.FindAndReplaceDialog.renderRangeOfFragments (/w/load.php?debug=false&lang=en&modules=ext.CodeMirror.lib%7Cext.visualEditor.core%7Coojs-ui-core%2Coojs-ui-widgets&skin=vector&version=0okwd4t:952)
    at VeUiFindAndReplaceDialog.ve.ui.FindAndReplaceDialog.renderFragments (/w/load.php?debug=false&lang=en&modules=ext.CodeMirror.lib%7Cext.visualEditor.core%7Coojs-ui-core%2Coojs-ui-widgets&skin=vector&version=0okwd4t:952)
    at run (/w/load.php?debug=false&lang=en&modules=ext.CodeMirror.lib%7Cext.visualEditor.core%7Coojs-ui-core%2Coojs-ui-widgets&skin=vector&version=0okwd4t:1048)
    at VeUiFindAndReplaceDialog.renderFragmentsThrottled (/w/load.php?debug=false&lang=en&modules=ext.CodeMirror.lib%7Cext.visualEditor.core%7Coojs-ui-core%2Coojs-ui-widgets&skin=vector&version=0okwd4t:1048)
    at VeUiFindAndReplaceDialog.ve.ui.FindAndReplaceDialog.onSurfaceViewPosition (/w/load.php?debug=false&lang=en&modules=ext.CodeMirror.lib%7Cext.visualEditor.core%7Coojs-ui-core%2Coojs-ui-widgets&skin=vector&version=0okwd4t:949)
    at VeCeMwWikitextSurface.oo.EventEmitter.emit (<anonymous>:233:445)
    at VeCeMwWikitextSurface.<anonymous> (/w/load.php?debug=false&lang=en&modules=ext.CodeMirror.lib%7Cext.visualEditor.core%7Coojs-ui-core%2Coojs-ui-widgets&skin=vector&version=0okwd4t:713)
    at later (/w/load.php?debug=false&lang=en&modules=ext.CodeMirror.lib%7Cext.visualEditor.core%7Coojs-ui-core%2Coojs-ui-widgets&skin=vector&version=0okwd4t:1048)

I think those started propping up after trying visual diff for curiosity (broken by Translate, of course).