Nikerabbit has uploaded a new change for review.

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

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

Use getLanguageCodeForWikiDomain in MT tool

To support old drafts with incorrect language codes.

Change-Id: Id8a197bbdef10eb66d5aab556cf152324f32d37f
---
M modules/tools/ext.cx.tools.mt.js
1 file changed, 10 insertions(+), 0 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.mt.js b/modules/tools/ext.cx.tools.mt.js
index 33935b5..298d046 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,
@@ -146,6 +151,11 @@
         * @return {jQuery.Promise}
         */
        function doMT( sourceLang, targetLang, sourceHtml ) {
+               // This is for backwards compatibility with old drafts. For 
example
+               // we have lots of drafts stored with language code "no".
+               sourceLang = mw.cx.siteMapper.getLanguageCodeForWikiDomain( 
sourceLang );
+               targetLang = mw.cx.siteMapper.getLanguageCodeForWikiDomain( 
targetLang );
+
                // TODO: Refactor
                var mtURL = mw.cx.siteMapper.getCXServerUrl( 
'/mt/$from/$to/$provider', {
                        $from: sourceLang,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id8a197bbdef10eb66d5aab556cf152324f32d37f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>

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

Reply via email to