Page MenuHomePhabricator

Unable to load partial translation due to JS error from ext.cx.tools.template.js
Closed, ResolvedPublic

Description

When I try to load a translation from
https://pt.wikipedia.org/wiki/Special:ContentTranslation?page=Puiseux+series&from=en&to=pt&targettitle=S%C3%A9ries+de+Puiseux
I get

VM161:75 Uncaught TypeError: Cannot read property 'length' of undefined
  at Template.init (<anonymous>:75:6128)
  at new Template (<anonymous>:75:5649)
  at Object.TemplateTool.static.processTemplate (<anonymous>:94:68)
  at TemplateTool.static.processBlockTemplate (<anonymous>:95:944)
  at fire (load.php?debug=false&lang=pt&modules=jquery%2Cmediawiki|mediawiki.legacy.wikibits&only=scripts&skin=vector&version=1b46sjy:46)
  at Object.fireWith (load.php?debug=false&lang=pt&modules=jquery%2Cmediawiki|mediawiki.legacy.wikibits&only=scripts&skin=vector&version=1b46sjy:47)
  at Object.fire (load.php?debug=false&lang=pt&modules=jquery%2Cmediawiki|mediawiki.legacy.wikibits&only=scripts&skin=vector&version=1b46sjy:176)
  at ContentTranslationLoader.restoreSection (<anonymous>:8:53)
  at ContentTranslationLoader.restore (<anonymous>:5:74)
  at <anonymous>:3:126

from
https://github.com/wikimedia/mediawiki-extensions-ContentTranslation/blob/37db8e0ebffcc97e5aa9ed41f7b2759b9dcf8f9a/modules/tools/ext.cx.tools.template.js#L71

The problem also happens with Firefox.

Event Timeline

He7d3r created this task.Dec 10 2017, 1:08 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 10 2017, 1:08 PM

Change 397408 had a related patch set uploaded (by Santhosh; owner: Santhosh):
[mediawiki/extensions/ContentTranslation@master] Guard against js errors for invalid/corrupted(?) templates

https://gerrit.wikimedia.org/r/397408

Change 397408 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] Guard against js errors for invalid/corrupted(?) templates

https://gerrit.wikimedia.org/r/397408

santhosh claimed this task.Dec 12 2017, 7:17 AM
santhosh moved this task from Backlog to QA on the Language-2017-Oct-Dec board.
Nikerabbit triaged this task as Medium priority.Dec 12 2017, 7:35 AM
Nikerabbit removed a project: Patch-For-Review.
Etonkovidova added a subscriber: Etonkovidova.EditedDec 15 2017, 1:56 AM

Checked in wmf.12 (English to Russian and Spanish translation) - no JS errors were displayed.

Etonkovidova closed this task as Resolved.Dec 15 2017, 1:57 AM
Nikerabbit moved this task from QA to Done on the Language-2017-Oct-Dec board.Dec 15 2017, 7:54 AM

I'm still unable to load that partial translation (it shows "Failed to load the saved translation!" at the top). But there is no error info in the console.

@santhosh can you take a look at it?

I re-checked the translation ("Puiseux series" from en to pt in cx-testing and in testwiki for en-catala) - saved partial translation can be loaded without any errors. Also, tried non-ASCII chars in the title - all seems to be fine. Maybe it's the saved translation itself has some unrecoverable errors?