Page MenuHomePhabricator

CX2: Paragraph becomes unusable when switching to 'Don't use machine translation' or 'Use source text'
Closed, ResolvedPublic

Description

Switching to 'Don't use machine translation' or 'Use source text' results in the translation paragraph being deleted and becoming unusable (it is not possible to select it to type, or switch to a different approach from the MT card).

The animation bellow shows the issue when translating "Lemonade" from English to Spanish and switching to 'Use source text' in CX2 testing servers:

A similar issue happens when switching to 'Don't use machine translation'. Steps to reproduce:

  1. On CX2 start a translation to English or from English.
  2. The default setting is 'User source text' - translate one paragraph and then change setting to 'Don't use machine translation' .

The Console will display:

Uncaught TypeError: Cannot read property 'getModel' of undefined
   at VeInitMwCXTarget.ve.init.mw.CXTarget.getTargetSectionNode
   at VeUiCXTranslationAction.

An additional example of the error will be translating 'Rudra' from español to català.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 7 2018, 12:43 AM
Etonkovidova updated the task description. (Show Details)Jul 9 2018, 10:16 PM
Pginer-WMF added a subscriber: Pginer-WMF.

The issue seems more severe than what I originally interpreted. It not only results in a console error as the description indicates, but the affected paragraph in the translation disappears completely, becoming unusable. This seems to happen for both "Don't use MT" and "Use source text".

I'll update the description.

Pginer-WMF renamed this task from CX2: 'Don't use machine translation' option produces 'Uncaught TypeError: Cannot read property 'getModel' of undefined' error for English translation to CX2: Paragraph becomes unusable when switching to 'Don't use machine translation' or 'Use source text' .Jul 10 2018, 9:11 AM
Pginer-WMF triaged this task as High priority.
Pginer-WMF updated the task description. (Show Details)
Pginer-WMF moved this task from Backlog to Priority backlog on the Language-2018-July-September board.
Pginer-WMF moved this task from Needs Triage to CX2 on the ContentTranslation board.

Change 446198 had a related patch set uploaded (by Petar.petkovic; owner: Petar.petkovic):
[mediawiki/extensions/ContentTranslation@master] Prevent "Cannot read property 'getModel' of undefined" errors

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

Change 446198 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] Prevent "Cannot read property 'getModel' of undefined" errors

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

Petar.petkovic moved this task from In Review to Blocked on the Language-2018-July-September board.

Errors from VE are still causing issues, 446198 solved CX part. Blocked on T199754.

dchan added a subscriber: dchan.Jul 27 2018, 2:01 PM

Hi @Petar.petkovic, can you tell me steps to reproduce the continuing issues (after Change 446198) you mentioned above? The points you make in T199754 look good, but I'd like to have a failing test case to verify against.

Hi @Petar.petkovic, can you tell me steps to reproduce the continuing issues (after Change 446198) you mentioned above? The points you make in T199754 look good, but I'd like to have a failing test case to verify against.

Hello :)
Open any translation in Content Translation. I have used articles in English and started translating to Spanish, where Apertium is the default machine translation engine.
After you click any "Add translation" placeholder, you will get the MT coming from the default provider. Change the option to "Use source text" or "Don't use machine translation" and you will see Cannot read property 'getOffset' of null, which is reported in T199754.

I haven't investigated if the issue should be solved further up in the call stack.

dchan added a comment.EditedJul 27 2018, 2:38 PM

Thanks! I'm not seeing the error, with parameters: page=Foo&from=en&to=es&targettitle=Bar&version=2&revision=<XXX> . It seems to work fine for me, on both my local installation and on wikipedia.org . Can you confirm a particular page+paragraph that fails for you on wikipedia.org?

Can you confirm a particular page+paragraph that fails for you on wikipedia.org?

For me it is easily reproducible with any paragraph on any page. Here is me starting a translation from some suggested article on srwiki (from English to Serbian), clicking on first paragraph and switching from Yandex to "Use source text" option.


Since group 2 wikis are still on 1.32.0-wmf.13, you see Cannot read property 'getModel' of undefined as well, but those are gone after 446198.

The page I've used in the example above is "page=Golden+goal&from=en&to=sr&targettitle=Golden+goal&version=2".

matmarex added a subscriber: matmarex.EditedJul 30 2018, 8:52 PM

I can reproduce, with this URL: https://es.wikipedia.org/w/index.php?title=Especial:Traducción_de_contenidos&version=2&page=Lemonade&from=en&to=es&targettitle=Lemonade (not sure how CX works, you might have to start your own translation of this page first)

It seems that the error only happens if the section you're switching to 'Don't use machine translation' or 'Use source text' is the only section of the article you started translating so far.

I think this happens because when the cxSection is removed (before being added again), there is no valid position in the document where the cursor can be placed.

Change 449392 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[VisualEditor/VisualEditor@master] ve.ce.Surface: Handle null native selections in #getSelectionState and #showSelectionState

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

Change 449392 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] ve.ce.Surface: Handle null native selections in #getSelectionState and #showSelectionState

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

Petar.petkovic moved this task from In Review to QA on the Language-2018-July-September board.
Petar.petkovic removed a subscriber: gerritbot.

Change 450658 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (deaf0394e)

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

Change 450658 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (efccd8b41)

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

Etonkovidova closed this task as Resolved.Aug 14 2018, 10:46 PM
Restricted Application added a project: User-Ryasmeen. · View Herald TranscriptAug 14 2018, 10:46 PM