Santhosh has uploaded a new change for review.

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

Change subject: Apply selected action on Translation card to the current 
paragraph too
......................................................................

Apply selected action on Translation card to the current paragraph too

Testplan:
Translate a section. Change the translation provider choice using
the MT tool card. The choice should be applied to the current section.

If choice is an MT engine, the current section will have the machine
translation.
If choice is 'Use source', the current section will get copy of source
section.
If the choice is no machine translation, the section will be cleared.

There is a bug about what happens if the section has user's manual translation.
This commit does not change any behavior on that. It just overwrites it as we 
do now.

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


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

diff --git a/modules/tools/ext.cx.tools.mt.js b/modules/tools/ext.cx.tools.mt.js
index b42e4d5..bb08f89 100644
--- a/modules/tools/ext.cx.tools.mt.js
+++ b/modules/tools/ext.cx.tools.mt.js
@@ -376,8 +376,18 @@
 
                // Set the global engine
                // TODO This should be saved in a preference or a cookie
-               MTControlCard.provider = providerId;
-
+               if ( MTControlCard.provider !== providerId ) {
+                       MTControlCard.provider = providerId;
+                       // Apply this choice to the current section.
+                       if ( providerId === sourceMT ) {
+                               this.useSource();
+                       } else if ( providerId === disableMT ) {
+                               this.clearTranslation();
+                       } else {
+                               // Must be an MT engine. Restore.
+                               this.restoreTranslation();
+                       }
+               }
                // Set the main label
                this.$providerSelectorTrigger.text( this.getProviderTitle( 
providerId ) );
        };

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ief487458de9743a10d99e441bcf06761e6db20ff
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