Santhosh has uploaded a new change for review.

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

Change subject: MT engine failure cause fallback translation not getting saved
......................................................................

MT engine failure cause fallback translation not getting saved

When an MT request to cxserver fails, we fallback to source translation.
The reason for failure can be anything - very large paragraph, network
timeout, failures from the MT engines. But when the fallback to
copy-source happens, what get saved to database is the placeholder div.

This was because the section reference is not updated in the failure
handler of MT request and holding old section value. Fixed this by
moving the section reference update code to the .always() handler.

Testplan:
(if you have local cxserver, this is more easy since you can simulate
MT engine failure)
Translate Hideo Hosono from en to fr. The 'Selected publications' section
is too long for Yandex to translate and will fallback to source. You
will also see translation saved status. Reload the page by pressing F5
or CTRL+R. This secion will not get restored and you will see a placeholder
with in progress indicator. Additionally you may inspect the translation
storage for the section too. With this patch, instead of placeholder,
the actual translation will get saved.

Bug: T137519
Change-Id: I72f6711a07389aa3c6b7852acd308f265aafd8a2
---
M modules/tools/ext.cx.tools.mt.js
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/84/293684/1

diff --git a/modules/tools/ext.cx.tools.mt.js b/modules/tools/ext.cx.tools.mt.js
index 675c80e..d5117d4 100644
--- a/modules/tools/ext.cx.tools.mt.js
+++ b/modules/tools/ext.cx.tools.mt.js
@@ -279,14 +279,14 @@
                                                        'data-cx-mt-provider': 
MTControlCard.provider
                                                } )
                                        );
-                                       // $section was replaced. Get the 
updated instance.
-                                       $section = mw.cx.getTranslationSection( 
sourceId );
                                }
                        } )
                        .fail( function ( reason ) {
                                mw.hook( 'mw.cx.translation.add' ).fire( 
sourceId, reason );
                        } )
                        .always( function () {
+                               // $section was replaced. Get the updated 
instance.
+                               $section = mw.cx.getTranslationSection( 
sourceId );
                                mw.hook( 'mw.cx.translation.postMT' ).fire( 
$section );
                        } );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/293684
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I72f6711a07389aa3c6b7852acd308f265aafd8a2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to