Page MenuHomePhabricator

2017WE doesn't allow accessing the Translate extension by clicking on Edit source
Closed, ResolvedPublic1 Estimated Story Points

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Btw, if I open the source of translatable message in the NWE and try to edit it, the edits are abandoned by the translation extension.

Btw, if I open the source of translatable message in the NWE and try to edit it, the edits are abandoned by the translation extension.

That's by design. The source is defined elsewhere, and editing the source message there wouldn't change anything.

Btw, if I open the source of translatable message in the NWE and try to edit it, the edits are abandoned by the translation extension.

That's by design. The source is defined elsewhere, and editing the source message there wouldn't change anything.

What do you mean in "elsewhere"? I turned off the NWE, and it worked as expected.

OK, here is the scenario:

  1. Opt in NWE.
  2. Open https://meta.wikimedia.org/wiki/Tech/News/2016/51.
  3. Open edit mode.
  4. Change something, for example remove a space after bullet.
  5. Try to save.
  6. You'll get a message "your editing was abandoned by Translation Extension. Click here to continue editing."
  7. Close the tab.
  8. Opt out NWE.
  9. Open the same page.
  10. Do the same edit.
  11. It works.

Naturally, there should be a way to edit translatable pages source - somebody should write them.

  1. I believe Translate is using the proper ways to propagate an error message, but that is not shown by VE.
  1. Investingating what is the issue, I find pt-shake-position which basically means that <!--T:#--> is in unexpected place. Inspecting the payload that is sent, I don't see why this would be the case.

Relevant code

				$rer1 = '~^<!--T:(.*?)-->( |\n)~'; // Normal sections
				$rer2 = '~\s*<!--T:(.*?)-->$~m'; // Sections with title
				$content = preg_replace( $rer1, '', $content );
				$content = preg_replace( $rer2, '', $content );

				if ( preg_match( $re, $content ) === 1 ) {
					throw new TPException( array( 'pt-shake-position', $content ) );

My guess would be that the line feeds sent by NWE are different (\r\n perhaps?) and it does not get normalized.

You can see the real edit that I tried to do, @Nikerabbit, here.

AlexMonk-WMF renamed this task from 2017WE doesn't allow accessing the Translate extension on Meta by clicking on Edit source to 2017WE doesn't allow accessing the Translate extension by clicking on Edit source.Dec 24 2016, 12:02 PM

Change 329053 had a related patch set uploaded (by Esanders):
Copy translate extension hack to source mode

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

Change 329053 merged by jenkins-bot:
Move translate extension hack up to 'isAvailable'

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

Jdforrester-WMF assigned this task to Esanders.
Jdforrester-WMF triaged this task as Medium priority.
Jdforrester-WMF set the point value for this task to 1.
Jdforrester-WMF moved this task from To Triage to TR1: Releases on the VisualEditor board.
Jdforrester-WMF subscribed.

OK, here is the scenario:

I can confirm that issue myself — but it's different from this task as filed. I'll mark this as done and create a new one.