Santhosh has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/381383 )

Change subject: Reference adaptation: Add a check for mt service
......................................................................

Reference adaptation: Add a check for mt service

Not all language pairs has mt client. Avoid error if mtClient is
undefined.

Change-Id: I16c59984420d44f87f0610b4d18c3b76a2bd0e17
---
M lib/translationunits/MWReference.js
1 file changed, 9 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/cxserver 
refs/changes/83/381383/1

diff --git a/lib/translationunits/MWReference.js 
b/lib/translationunits/MWReference.js
index 4e74580..337f24e 100644
--- a/lib/translationunits/MWReference.js
+++ b/lib/translationunits/MWReference.js
@@ -42,12 +42,16 @@
        }
 
        // TODO: Parse recursively instead of just MTing to handle templates
-       // Translate reference contents
-       let translatedRefBody = yield this.context.conf.mtClient.translate(
-               this.sourceLanguage, this.targetLanguage, refBody
-       );
 
-       refData.body.html = translatedRefBody;
+       if ( this.context.conf.mtClient ) {
+               // Translate reference contents
+               let translatedRefBody = yield 
this.context.conf.mtClient.translate(
+                       this.sourceLanguage, this.targetLanguage, refBody
+               );
+
+               refData.body.html = translatedRefBody;
+       }
+
        this.node.attributes[ 'data-mw' ] = JSON.stringify( refData );
        this.node.attributes[ 'data-cx' ] = JSON.stringify( {
                adapted: true

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I16c59984420d44f87f0610b4d18c3b76a2bd0e17
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/cxserver
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