- Start fresh translation
- Translate one paragraph
- Switch to "Don't use MT", if it's not already applied by default
- Return to dashboard and open draft again
- Switch previously blanked section to some MT provider
- Return to dashboard
- Open the draft to see that section is still blanked and MT provided content is missing
|mediawiki/extensions/ContentTranslation : master||Restore: Use the timestamps of the translation units to choose one|
I followed the same steps and inspected what is coming out from database at step 7. Here is the output from query contenttranslation api output
As we can see, there is user translation that blanks the section. There is html, but no text content(From step 3). Then there is unmodified MT from Apertium(From step 5)
The restore logic we have is this:
restoredContent = OO.getProp( savedSection, 'user', 'content' ) || OO.getProp( savedSection, 'mt', 'content' );
Tthis is based on a (wrong) assumption that if there is user translation, that is always the latest content than unmodified content. Which is wrong in the case of Blank->Unmodified MT step. If there is user translation just after Unmodified MT stage, the issue wont happen.
I am inclined to use the timestamp of the records instead of the above logic. From the examples, you can see, User translation is at 2018-09-03T09:35:00Z and unmodified MT is at 2018-09-03T09:36:56Z which is one minute later than user translation. So unmodified MT is the recent content.
I created T204038: Updates to the section does not update the timestamp in cx_corpora table to track the issue of TranslationStorageManager not updating timestamp. This ticket as its original description is still valid and the fix in the https://gerrit.wikimedia.org/r/457410 is still valid. That fix exposed the issue with time stamps. So I will retain the old description.