Nikerabbit has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/359377 )
Change subject: Simplify code a bit
......................................................................
Simplify code a bit
Removed get/setTranslationSource. The SectionTranslationUnit model
already handles this.
Change-Id: I159edf970ba207d412768f529d9826007a84c92d
---
M modules/dm/translationunits/mw.cx.dm.LinkTranslationUnit.js
M modules/dm/translationunits/mw.cx.dm.TranslationUnit.js
M modules/mw.cx.TranslationController.js
3 files changed, 5 insertions(+), 16 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation
refs/changes/77/359377/1
diff --git a/modules/dm/translationunits/mw.cx.dm.LinkTranslationUnit.js
b/modules/dm/translationunits/mw.cx.dm.LinkTranslationUnit.js
index 5d81bd6..36f1627 100644
--- a/modules/dm/translationunits/mw.cx.dm.LinkTranslationUnit.js
+++ b/modules/dm/translationunits/mw.cx.dm.LinkTranslationUnit.js
@@ -86,7 +86,6 @@
* @return {jQuery.Promise}
*/
mw.cx.dm.LinkTranslationUnit.prototype.adapt = function () {
-
if ( this.targetDocument ) {
this.redlink = this.targetDocument.classList.contains( 'new' );
mw.log.warn( '[CX] Adapting a link which looks already adapted:
' + this );
diff --git a/modules/dm/translationunits/mw.cx.dm.TranslationUnit.js
b/modules/dm/translationunits/mw.cx.dm.TranslationUnit.js
index 1a5dafc..955cc9f 100644
--- a/modules/dm/translationunits/mw.cx.dm.TranslationUnit.js
+++ b/modules/dm/translationunits/mw.cx.dm.TranslationUnit.js
@@ -38,8 +38,6 @@
this.sourceLanguage = config.sourceLanguage;
this.targetLanguage = config.targetLanguage;
this.parentTranslationUnit = null;
- // Source of the translation. Can be source, user, Apertium, Yandex etc
- this.translationSource = null;
// Parent constructor
mw.cx.dm.TranslationUnit.super.call( this );
this.connect( this, {
@@ -275,14 +273,6 @@
}
return 'cx' + this.getSectionId();
-};
-
-mw.cx.dm.TranslationUnit.prototype.getTranslationSource = function () {
- return this.translationSource;
-};
-
-mw.cx.dm.TranslationUnit.prototype.setTranslationSource = function (
translationSource ) {
- this.translationSource = translationSource;
};
/**
diff --git a/modules/mw.cx.TranslationController.js
b/modules/mw.cx.TranslationController.js
index 9323e19..3a4cf90 100644
--- a/modules/mw.cx.TranslationController.js
+++ b/modules/mw.cx.TranslationController.js
@@ -204,7 +204,7 @@
/**
* Get the records for saving the translation unit.
- * @param {mw.cx.dm.translationUnit} translationUnit
+ * @param {mw.cx.dm.SectionTranslationUnit} translationUnit
* @return {Object[]} Objects to save
*/
mw.cx.TranslationController.prototype.getTranslationUnitData = function (
translationUnit ) {
@@ -215,12 +215,12 @@
validate = false;
sequenceId = translationUnit.sourceDocument.getAttribute( 'data-seqid'
);
- translationSource = translationUnit.getTranslationSource();
- if ( translationSource === 'mt' ) {
- origin = translationUnit.getMachineTranslationProvider();
- } else {
+ /// XXX should use the promise, but at this point the member variable
should always be present
+ translationSource = translationUnit.MTProvider;
+ if ( translationSource === 'source' ) {
origin = 'user';
}
+
records.push( {
content: translationUnit.getTargetDocument().outerHTML,
sectionId: translationUnit.sourceDocument.id, // source section
id is the canonical section id.
--
To view, visit https://gerrit.wikimedia.org/r/359377
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I159edf970ba207d412768f529d9826007a84c92d
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