jenkins-bot has submitted this change and it was merged.

Change subject: Use getLanguageCodeForWikiDomain in MT tool
......................................................................


Use getLanguageCodeForWikiDomain in MT tool

To support old drafts with incorrect language codes.

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

Approvals:
  Santhosh: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/tools/ext.cx.tools.mt.js b/modules/tools/ext.cx.tools.mt.js
index 33935b5..675c80e 100644
--- a/modules/tools/ext.cx.tools.mt.js
+++ b/modules/tools/ext.cx.tools.mt.js
@@ -85,6 +85,11 @@
                        return $.Deferred().resolve();
                }
 
+               // This is for backwards compatibility with old drafts. For 
example
+               // we have lots of drafts stored with language code "no".
+               from = mw.cx.siteMapper.getLanguageCodeForWikiDomain( from );
+               to = mw.cx.siteMapper.getLanguageCodeForWikiDomain( to );
+
                // TODO: Refactor
                fetchProvidersUrl = mw.cx.siteMapper.getCXServerUrl( 
'/list/mt/$from/$to', {
                        $from: from,
@@ -148,8 +153,10 @@
        function doMT( sourceLang, targetLang, sourceHtml ) {
                // TODO: Refactor
                var mtURL = mw.cx.siteMapper.getCXServerUrl( 
'/mt/$from/$to/$provider', {
-                       $from: sourceLang,
-                       $to: targetLang,
+                       // This is for backwards compatibility with old drafts. 
For example
+                       // we have lots of drafts stored with language code 
"no".
+                       $from: mw.cx.siteMapper.getLanguageCodeForWikiDomain( 
sourceLang ),
+                       $to: mw.cx.siteMapper.getLanguageCodeForWikiDomain( 
targetLang ),
                        $provider: MTControlCard.provider
                } );
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id8a197bbdef10eb66d5aab556cf152324f32d37f
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>
Gerrit-Reviewer: Santhosh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to