Santhosh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/154996
Change subject: MT: Send simplified HTML to MT API. Remove data-* attribtues
......................................................................
MT: Send simplified HTML to MT API. Remove data-* attribtues
Change-Id: I5aef6c2bd87e9d17335c84257d7cb9d1355d524f
---
M modules/tools/ext.cx.tools.mt.js
1 file changed, 14 insertions(+), 0 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation
refs/changes/96/154996/1
diff --git a/modules/tools/ext.cx.tools.mt.js b/modules/tools/ext.cx.tools.mt.js
index 4e96c49..e25c006 100644
--- a/modules/tools/ext.cx.tools.mt.js
+++ b/modules/tools/ext.cx.tools.mt.js
@@ -64,12 +64,26 @@
}
/**
+ * Clean up the section by removing data-parsoid and data-mw attributes
+ * @param {jQuery} $section
+ */
+ function doPreTranslateCleanup( $section ) {
+ $section
+ .removeAttr( 'data-parsoid' )
+ .removeAttr( 'data-mw' )
+ .find( '*' )
+ .removeAttr( 'data-parsoid' )
+ .removeAttr( 'data-mw' );
+ }
+
+ /**
* A plugin that performs machine translation on an element.
* @param {text} text
*/
$.fn.machineTranslate = function () {
var $section = $( this );
+ doPreTranslateCleanup( $section );
getProviders( mw.cx.sourceLanguage, mw.cx.targetLanguage
).then( function () {
var sourceContent;
--
To view, visit https://gerrit.wikimedia.org/r/154996
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5aef6c2bd87e9d17335c84257d7cb9d1355d524f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits