[MediaWiki-commits] [Gerrit] Refactor the dashboard and translationlist modules - change (mediawiki...ContentTranslation)

2015-08-17 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Refactor the dashboard and translationlist modules
..

Refactor the dashboard and translationlist modules

Translation list module was handling the rendering and event
handlers of translation status filter and language selectors.
It was also rendering the new translation button.

This commit removes all the above features to the dashboard module.
Translation list is now just a widget to list the translations.

This change is to initiate the listing of suggestion initiated by
dashboard module and provide way for suggestion list to share the
language filters.

Functionality wise nothing changed.

Change-Id: Ie5bbcb3a01dfa0b136ad8fa000ca1f52a7a98878
---
M extension.json
M modules/dashboard/ext.cx.dashboard.js
M modules/dashboard/ext.cx.translationlist.js
M scripts/manage-lists.php
4 files changed, 269 insertions(+), 266 deletions(-)


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

diff --git a/extension.json b/extension.json
index abbb8d1..c1604cf 100644
--- a/extension.json
+++ b/extension.json
@@ -42,6 +42,7 @@
},
"APIListModules": {
"contenttranslation": "ApiQueryContentTranslation",
+   "contenttranslationlist": "ApiQueryContentTranslationList",
"contenttranslationstats": "ApiQueryContentTranslationStats",
"contenttranslationlangtrend": 
"ApiQueryContentTranslationLanguageTrend",
"cxpublishedtranslations": "ApiQueryPublishedTranslations"
@@ -59,6 +60,7 @@
"ApiContentTranslationPublish": 
"api/ApiContentTranslationPublish.php",
"ApiContentTranslationToken": 
"api/ApiContentTranslationToken.php",
"ApiQueryContentTranslation": 
"api/ApiQueryContentTranslation.php",
+   "ApiQueryContentTranslationList": 
"api/ApiQueryContentTranslationList.php",
"ApiQueryContentTranslationLanguageTrend": 
"api/ApiQueryContentTranslationLanguageTrend.php",
"ApiQueryContentTranslationStats": 
"api/ApiQueryContentTranslationStats.php",
"ApiQueryPublishedTranslations": 
"api/ApiQueryPublishedTranslations.php",
@@ -193,6 +195,7 @@
"ext.cx.header",
"ext.cx.model",
"ext.cx.sitemapper",
+   "ext.cx.source.selector",
"ext.cx.translationlist",
"mediawiki.Uri",
"mediawiki.ui.button"
@@ -202,7 +205,13 @@
"cx-dashboard-sidebar-title",
"cx-dashboard-sidebar-information",
"cx-dashboard-sidebar-stats",
-   "cx-dashboard-sidebar-feedback"
+   "cx-dashboard-sidebar-feedback",
+   "cx-create-new-translation",
+   "cx-translation-filter-suggested-translations",
+   "cx-translation-filter-published-translations",
+   "cx-translation-filter-draft-translations",
+   "cx-translation-filter-from-any-language",
+   "cx-translation-filter-to-any-language"
]
},
"ext.cx.magnuslink": {
@@ -741,7 +750,6 @@
],
"dependencies": [
"ext.cx.progressbar",
-   "ext.cx.source.selector",
"ext.cx.util",
"ext.cx.widgets.overlay",
"jquery.uls.data",
@@ -749,12 +757,6 @@
],
"messages": [
"cx-dashboard-header",
-   "cx-create-new-translation",
-   "cx-translation-filter-suggested-translations",
-   "cx-translation-filter-published-translations",
-   "cx-translation-filter-draft-translations",
-   "cx-translation-filter-from-any-language",
-   "cx-translation-filter-to-any-language",
"cx-discard-translation",
"cx-translation-status-draft",
"cx-translation-status-deleted",
diff --git a/modules/dashboard/ext.cx.dashboard.js 
b/modules/dashboard/ext.cx.dashboard.js
index 467da96..ac36202 100644
--- a/modules/dashboard/ext.cx.dashboard.js
+++ b/modules/dashboard/ext.cx.dashboard.js
@@ -20,23 +20,94 @@
this.si

[MediaWiki-commits] [Gerrit] [WIP] Dashboard: Show translation suggestions - change (mediawiki...ContentTranslation)

2015-08-17 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: [WIP] Dashboard: Show translation suggestions
..

[WIP] Dashboard: Show translation suggestions

Change-Id: I503310492a7bac3f4072042bb1e64b9e2ed4891b
---
M extension.json
M modules/dashboard/ext.cx.dashboard.js
A modules/dashboard/ext.cx.suggestionlist.js
A modules/dashboard/styles/ext.cx.suggestionlist.less
4 files changed, 348 insertions(+), 5 deletions(-)


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

diff --git a/extension.json b/extension.json
index c1604cf..eabfd35 100644
--- a/extension.json
+++ b/extension.json
@@ -197,6 +197,7 @@
"ext.cx.sitemapper",
"ext.cx.source.selector",
"ext.cx.translationlist",
+   "ext.cx.suggestionlist",
"mediawiki.Uri",
"mediawiki.ui.button"
],
@@ -768,6 +769,18 @@
"cx-translationlist-empty-desc"
]
},
+   "ext.cx.suggestionlist": {
+   "scripts": [
+   "dashboard/ext.cx.suggestionlist.js"
+   ],
+   "styles": [
+   "dashboard/styles/ext.cx.suggestionlist.less"
+   ],
+   "dependencies": [
+   "ext.cx.util",
+   "jquery.uls.data"
+   ]
+   },
"ext.cx.translation.conflict": {
"scripts": [
"translation/ext.cx.translation.conflict.js"
diff --git a/modules/dashboard/ext.cx.dashboard.js 
b/modules/dashboard/ext.cx.dashboard.js
index ac36202..91b2d67 100644
--- a/modules/dashboard/ext.cx.dashboard.js
+++ b/modules/dashboard/ext.cx.dashboard.js
@@ -39,6 +39,27 @@
};
 
/**
+* Get all the translation suggestion lists of given user.
+*
+* @return {jQuery.Promise}
+*/
+   CXDashboard.prototype.getSuggestionLists = function () {
+   var storedSourceLanguage, storedTargetLanguage, api = new 
mw.Api();
+   if ( window.localStorage ) {
+   storedTargetLanguage = localStorage.getItem( 
'cxTargetLanguage' );
+   storedSourceLanguage = localStorage.getItem( 
'cxSourceLanguage' );
+   }
+
+   return api.get( {
+   action: 'query',
+   list: 'contenttranslationlist',
+   from: storedSourceLanguage || 'en', // FIXME do 
something smart here
+   to: storedTargetLanguage || mw.config.get( 
'wgContentLanguage' ),
+   format: 'json'
+   } );
+   };
+
+   /**
 * Get all the translations of given user.
 *
 * @return {jQuery.Promise}
@@ -64,7 +85,11 @@
response.query.contenttranslation.translations
);
} );
-   // TODO: Get suggestions
+   this.getSuggestionLists().done( function ( response ) {
+   self.renderTranslationSuggestions(
+   
response.query.contenttranslationlist.lists.missingfeaturedarticles
+   );
+   } );
};
 
/**
@@ -84,6 +109,15 @@
);
}
};
+
+   /**
+* Populates various UI components with data in the given translation 
suggestions.
+*/
+   CXDashboard.prototype.renderTranslationSuggestions = function ( 
suggestions ) {
+   this.suggestionList = new mw.cx.CXSuggestionList( 
this.$translationListContainer, suggestions, this.siteMapper );
+   this.suggestionList.init();
+   };
+
/**
 * Populates various UI components with data in the given translations.
 */
@@ -213,11 +247,14 @@
.addClass( 'cx-statusfilter' )
.append(
$( '' )
-   .addClass( 'cx-status cx-status--draft 
cx-status--selected mw-ui-input' )
-   .text( mw.msg( 
'cx-translation-filter-draft-translations' ) ),
+   .addClass( 'cx-status 
cx-status--suggestions mw-ui-input' )
+   .text( 'Suggestions' ),
$( '' )
-   .addClass( 'cx-status cx-status--published 
mw-ui-input' )
-   .text( mw.msg( 
'cx-translation-filter

[MediaWiki-commits] [Gerrit] Temporarily disable notifications - change (mediawiki...ContentTranslation)

2015-08-19 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Temporarily disable notifications
..

Temporarily disable notifications

Temporary fix for T109063 and T108559
till we figure out and fix the actual issue

Bug: T108559
Change-Id: Ia1b9697c8f4792f825d88416741ac148b61bf89b
---
M api/ApiContentTranslationPublish.php
1 file changed, 2 insertions(+), 1 deletion(-)


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

diff --git a/api/ApiContentTranslationPublish.php 
b/api/ApiContentTranslationPublish.php
index f991e11..23caae8 100755
--- a/api/ApiContentTranslationPublish.php
+++ b/api/ApiContentTranslationPublish.php
@@ -217,7 +217,8 @@
}
$this->saveTranslationHistory( $params );
// Notify user about milestones
-   $this->notifyTranslator();
+   // Temporary fix for T109063 and T108559
+   // $this->notifyTranslator();
} else {
$result = array(
'result' => 'error',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia1b9697c8f4792f825d88416741ac148b61bf89b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Revert "Temporarily disable notifications" - change (mediawiki...ContentTranslation)

2015-08-19 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Revert "Temporarily disable notifications"
..

Revert "Temporarily disable notifications"

This reverts commit a64d657b26bb019b0c0c47c2d19cef42e721e253.
The fix for bug T109063 was deployed.

Bug: T108559
Change-Id: I62850352e897fd78baa3999b6b8297f3b4fe03a2
---
M api/ApiContentTranslationPublish.php
1 file changed, 1 insertion(+), 2 deletions(-)


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

diff --git a/api/ApiContentTranslationPublish.php 
b/api/ApiContentTranslationPublish.php
index 23caae8..f991e11 100755
--- a/api/ApiContentTranslationPublish.php
+++ b/api/ApiContentTranslationPublish.php
@@ -217,8 +217,7 @@
}
$this->saveTranslationHistory( $params );
// Notify user about milestones
-   // Temporary fix for T109063 and T108559
-   // $this->notifyTranslator();
+   $this->notifyTranslator();
} else {
$result = array(
'result' => 'error',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I62850352e897fd78baa3999b6b8297f3b4fe03a2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Refactor the dashboard and translationlist modules - change (mediawiki...ContentTranslation)

2015-08-19 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Refactor the dashboard and translationlist modules
..

Refactor the dashboard and translationlist modules

Translation list module was handling the rendering and event
handlers of translation status filter and language selectors.
It was also rendering the new translation button.

This commit removes all the above features to the dashboard module.
Translation list is now just a widget to list the translations.

This change is to initiate the listing of suggestion initiated by
dashboard module and provide way for suggestion list to share the
language filters.

Functionality wise nothing changed.

Change-Id: I647c4b5348e59f3c5385a08907b1953da113952e
---
M extension.json
M modules/dashboard/ext.cx.dashboard.js
M modules/dashboard/ext.cx.translationlist.js
M modules/dashboard/styles/ext.cx.dashboard.less
M modules/dashboard/styles/ext.cx.translationlist.less
5 files changed, 418 insertions(+), 421 deletions(-)


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

diff --git a/extension.json b/extension.json
index 405ff73..7ddc679 100644
--- a/extension.json
+++ b/extension.json
@@ -192,6 +192,7 @@
"ext.cx.header",
"ext.cx.model",
"ext.cx.sitemapper",
+   "ext.cx.source.selector",
"ext.cx.translationlist",
"mediawiki.Uri",
"mediawiki.ui.button"
@@ -201,7 +202,13 @@
"cx-dashboard-sidebar-title",
"cx-dashboard-sidebar-information",
"cx-dashboard-sidebar-stats",
-   "cx-dashboard-sidebar-feedback"
+   "cx-dashboard-sidebar-feedback",
+   "cx-create-new-translation",
+   "cx-translation-filter-suggested-translations",
+   "cx-translation-filter-published-translations",
+   "cx-translation-filter-draft-translations",
+   "cx-translation-filter-from-any-language",
+   "cx-translation-filter-to-any-language"
]
},
"ext.cx.magnuslink": {
@@ -740,7 +747,6 @@
],
"dependencies": [
"ext.cx.progressbar",
-   "ext.cx.source.selector",
"ext.cx.util",
"ext.cx.widgets.overlay",
"jquery.uls.data",
@@ -748,12 +754,6 @@
],
"messages": [
"cx-dashboard-header",
-   "cx-create-new-translation",
-   "cx-translation-filter-suggested-translations",
-   "cx-translation-filter-published-translations",
-   "cx-translation-filter-draft-translations",
-   "cx-translation-filter-from-any-language",
-   "cx-translation-filter-to-any-language",
"cx-discard-translation",
"cx-translation-status-draft",
"cx-translation-status-deleted",
diff --git a/modules/dashboard/ext.cx.dashboard.js 
b/modules/dashboard/ext.cx.dashboard.js
index 467da96..2583557 100644
--- a/modules/dashboard/ext.cx.dashboard.js
+++ b/modules/dashboard/ext.cx.dashboard.js
@@ -20,23 +20,95 @@
this.siteMapper = siteMapper;
this.$header = null;
this.$sidebar = null;
-   this.$translationList = null;
+   this.translationList = null;
+   this.$translationListContainer = null;
this.$newTranslationButton = null;
+   this.$filter = null;
+   this.$listHeader = null;
+   this.$sourceLanguageFilter = null;
+   this.$targetLanguageFilter = null;
+   this.$cta = null;
this.init();
}
 
CXDashboard.prototype.init = function () {
this.render();
-   this.initComponents();
+   this.initLists();
this.listen();
mw.hook( 'mw.cx.dashboard.ready' ).fire();
};
 
/**
+* Get all the translations of given user.
+*
+* @return {jQuery.Promise}
+*/
+   CXDashboard.prototype.getTranslations = function () {
+   var api = new mw.Api();
+
+

[MediaWiki-commits] [Gerrit] Validate the references when restored from draft - change (mediawiki...ContentTranslation)

2015-08-19 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Validate the references when restored from draft
..

Validate the references when restored from draft

If the references in source article changed, the references
in translation might point to invalid items in references list.
This can cause publishing error because of parsoid error.

For such dangling references in translation, remove them if they
point to invalid references in references list.

Bug: T109574
Change-Id: I83702f8c1df5e8a79dc185a34fc03acd93496415
---
M modules/tools/ext.cx.tools.reference.js
1 file changed, 8 insertions(+), 0 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.reference.js 
b/modules/tools/ext.cx.tools.reference.js
index 2169885..56c21cb 100644
--- a/modules/tools/ext.cx.tools.reference.js
+++ b/modules/tools/ext.cx.tools.reference.js
@@ -296,6 +296,14 @@
.find( '.mw-reference-text' );
mwData.body.id = $referenceContent.prop( 'id' );
}
+   // Makre sure that the data-mw.body.id points to an element 
that exists. otherwise
+   // remove that reference. This happens when references in 
source article changed
+   // and the reference in draft translation no longer points to a 
valid reference.
+   // See T109574
+   if ( mwData.body.id && !document.getElementById( mwData.body.id 
) ) {
+   $targetReference.remove();
+   return;
+   }
$targetReference.attr( 'data-mw', JSON.stringify( mwData ) );
this.addReferenceList();
};

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I83702f8c1df5e8a79dc185a34fc03acd93496415
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix JSCS errors - change (mediawiki...ContentTranslation)

2015-07-26 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Fix JSCS errors
..

Fix JSCS errors

Change-Id: I741f327203b91bc20a94578ff4308ea8371431af
---
M modules/dashboard/ext.cx.translationlist.js
M modules/tools/ext.cx.tools.mt.js
2 files changed, 8 insertions(+), 4 deletions(-)


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

diff --git a/modules/dashboard/ext.cx.translationlist.js 
b/modules/dashboard/ext.cx.translationlist.js
index 5eb9337..9ed86d1 100644
--- a/modules/dashboard/ext.cx.translationlist.js
+++ b/modules/dashboard/ext.cx.translationlist.js
@@ -210,7 +210,7 @@
$( '' )
.prop( {
lang: 
translation.targetLanguage,
-   dir: targetDir,
+   dir: targetDir
} )
.addClass( 'target-title' )
.text( translation.targetTitle )
diff --git a/modules/tools/ext.cx.tools.mt.js b/modules/tools/ext.cx.tools.mt.js
index 6773c10..78fc16b 100644
--- a/modules/tools/ext.cx.tools.mt.js
+++ b/modules/tools/ext.cx.tools.mt.js
@@ -46,8 +46,10 @@
}
 
// (Re-)fetch cxserver token
-   cxserverToken.promise = (new mw.Api())
-   .postWithToken( 'edit', { action: 'cxtoken' } )
+   cxserverToken.promise = ( new mw.Api() )
+   .postWithToken( 'edit', {
+   action: 'cxtoken'
+   } )
.always( function () {
cxserverToken.promise = undefined;
} )
@@ -136,7 +138,9 @@
type: 'post',
url: mtURL,
data: sourceHtml,
-   headers: { Authorization: token }
+   headers: {
+   Authorization: token
+   }
} ).then( null, function () {
return $.Deferred().reject( 'service-failure', 
arguments ).promise();
} );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I741f327203b91bc20a94578ff4308ea8371431af
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Don't swap link cards when opening the link of the card behind - change (mediawiki...ContentTranslation)

2015-07-26 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Don't swap link cards when opening the link of the card behind
..

Don't swap link cards when opening the link of the card behind

Link cards are presented usually in pairs. Although the card in front
represents the main action (add/remove link in the translation),
it is possible to explore the card behind by either hovering
(the card behind is temporary revealed allowing to click on the link
to open it) or clicking on the card (cards switch positions).
The problem is that when the link from the card behind it is opened,
the click event propagates to the whole card and the cards are also swapped.
Cards should be only swapped when clicking on the card behind except when 
clicking on the link.

Bug: T106595
Change-Id: I0873eb77b082c06004718a6e7b737d1a9fa97062
---
M modules/tools/ext.cx.tools.link.js
1 file changed, 5 insertions(+), 2 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index edcaa43..35152b6 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -797,8 +797,11 @@
var self = this;
 
// Bring the card to front when clicked
-   this.$card.on( 'click', '.card:first', function () {
-   $( this ).insertAfter( self.$card.find( '.card:last' ) 
);
+   this.$card.on( 'click', '.card:first', function ( e ) {
+   if ( !$( e.target ).is( 'a' ) ) {
+   // We should not swap the cards when click was 
on the link in the card.
+   $( this ).insertAfter( self.$card.find( 
'.card:last' ) );
+   }
} );
};
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0873eb77b082c06004718a6e7b737d1a9fa97062
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Allow to scroll suggested lists of links in the link inspector - change (mediawiki...ContentTranslation)

2015-07-26 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Allow to scroll suggested lists of links in the link inspector
..

Allow to scroll suggested lists of links in the link inspector

Set max-height for page selector menu and make it scrollable.

Bug: T106530
Change-Id: I3d4ed5befb40d03dc2996f91050e7332dc8c39d6
---
M modules/widgets/pageselector/ext.cx.pageselector.less
1 file changed, 2 insertions(+), 0 deletions(-)


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

diff --git a/modules/widgets/pageselector/ext.cx.pageselector.less 
b/modules/widgets/pageselector/ext.cx.pageselector.less
index 3a2ca14..c98957f 100644
--- a/modules/widgets/pageselector/ext.cx.pageselector.less
+++ b/modules/widgets/pageselector/ext.cx.pageselector.less
@@ -11,6 +11,8 @@
// Show it on top of others
z-index: ;
max-width: 30%;
+   max-height: 300px;
+   overflow-y: auto;
 
&> li {
border-bottom: 1px solid #eee;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3d4ed5befb40d03dc2996f91050e7332dc8c39d6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix: Creating an external link with no text selected results... - change (mediawiki...ContentTranslation)

2015-07-26 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Fix: Creating an external link with no text selected results 
link label as "null"
..

Fix: Creating an external link with no text selected results link label as 
"null"

Testplan:
Without selecting any text, use link tool to add an external link. Once URL
entered, press enter. The link should be inserted at cursor position, with
label as link URL. Link label should not be null.

Bug: T106521
Change-Id: Ie904fb6f1b8b952a38eb7926d1d72c4cf428728e
---
M modules/tools/ext.cx.tools.link.js
1 file changed, 4 insertions(+), 1 deletion(-)


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

diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index edcaa43..2754565 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -1048,7 +1048,10 @@
self.$pageSelectorButton.prop( 'disabled', false );
} ).on( 'keypress', function ( e ) {
if ( e.which === 13 ) {
-   self.createLink( 
self.$targetPageSelector.getSelectedPage(), 'external' );
+   if ( linkType === 'external' ) {
+   self.createLink( 
self.$externalLinkInput.val(), linkType );
+   }
+   // TODO: Add internal link also on enter 
keypress.
}
} );
this.$internalLink.on( 'click', function () {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie904fb6f1b8b952a38eb7926d1d72c4cf428728e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] When link target changed, reset the style classes - change (mediawiki...ContentTranslation)

2015-07-26 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: When link target changed, reset the style classes
..

When link target changed, reset the style classes

When the link inspector is used on a red link or a red link to create
a regular link, it is expected for the resulting link to become blue.
Currently, the link remains red or grey (as it was before) which is confusing.

Bug: T106437
Change-Id: Id86d4f154b1fbbbd9c411f24fadc7a7356a8f7fa
---
M modules/tools/ext.cx.tools.link.js
1 file changed, 2 insertions(+), 0 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index edcaa43..602d3b8 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -970,6 +970,8 @@
href: target.title,
title: target.title
} )
+   // Remove the classes that represent a 
different state for link.
+   .removeClass( 'cx-selection 
cx-highlight--blue new cx-target-link-unadapted' )
.removeData( 'cxTargetLink' ) // Unbind
.cxTargetLink();
} else {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id86d4f154b1fbbbd9c411f24fadc7a7356a8f7fa
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Allow to add a link by pressing enter from the link inspector - change (mediawiki...ContentTranslation)

2015-07-26 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Allow to add a link by pressing enter from the link inspector
..

Allow to add a link by pressing enter from the link inspector

When a page is selected to be added as a link, the user needs to
press a button to complete the link creation.
Allow to trigger that action by pressing enter too for keyboard-only users.

Bug: T106441
Change-Id: I1f6e1dfb89814697043df8cd3415d80578bee4f9
---
M modules/tools/ext.cx.tools.link.js
M modules/widgets/pageselector/ext.cx.pageselector.js
2 files changed, 11 insertions(+), 2 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index edcaa43..54f457a 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -912,6 +912,7 @@
 * @return {jQuery}
 */
LinkerTool.prototype.getCard = function () {
+   var self = this;
this.$pageSelectorButton = $( '' )
.prop( 'disabled', true )
.addClass( 'mw-ui-button mw-ui-progressive' )
@@ -948,7 +949,10 @@
 
this.$targetPageSelector = new mw.PageSelector( 
this.$searchInput, {
api: mw.cx.siteMapper.getApi( mw.cx.targetLanguage ),
-   showMissingPage: true
+   showMissingPage: true,
+   onSelect: function ( selectedPage ) {
+   self.createLink( selectedPage, 'internal' );
+   }
} );
 
return this.$card;
diff --git a/modules/widgets/pageselector/ext.cx.pageselector.js 
b/modules/widgets/pageselector/ext.cx.pageselector.js
index 6821140..ef70272 100644
--- a/modules/widgets/pageselector/ext.cx.pageselector.js
+++ b/modules/widgets/pageselector/ext.cx.pageselector.js
@@ -244,6 +244,9 @@
if ( event.keyCode === 13 ) {
// Enter key handler
self.hide();
+   if ( self.options.onSelect ) {
+   self.options.onSelect.call( self, 
self.getSelectedPage() );
+   }
return false;
}
} );
@@ -257,6 +260,8 @@
// Example: mw.Api( { ajax: { url: apiURL } } )
api: new mw.Api(),
// Show a missing page if search did not return any page.
-   showMissingPage: false
+   showMissingPage: false,
+   // Callback when a page is selected
+   onSelect: null
};
 }( jQuery, mediaWiki ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1f6e1dfb89814697043df8cd3415d80578bee4f9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Avoid providing Special:CX for blocked users - change (mediawiki...ContentTranslation)

2015-07-27 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Avoid providing Special:CX for blocked users
..

Avoid providing Special:CX for blocked users

We have this check at publishing stage, but that is late and wastes
users time.

Bug: T100498
Change-Id: Ib6cdcc2e5f6e7fc631e5ff7d1d3a4f812f5fa6a6
---
M ContentTranslation.hooks.php
1 file changed, 4 insertions(+), 0 deletions(-)


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

diff --git a/ContentTranslation.hooks.php b/ContentTranslation.hooks.php
index 1454ec2..f73edd2 100644
--- a/ContentTranslation.hooks.php
+++ b/ContentTranslation.hooks.php
@@ -25,6 +25,10 @@
return false;
}
 
+   if ( $user->isBlocked() ) {
+   return false;
+   }
+
if ( !$wgContentTranslationAsBetaFeature ) {
return true;
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib6cdcc2e5f6e7fc631e5ff7d1d3a4f812f5fa6a6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Allow placing cursor inside empty list when translating from... - change (mediawiki...ContentTranslation)

2015-07-27 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Allow placing cursor inside empty list when translating from 
scratch
..

Allow placing cursor inside empty list when translating from scratch

Testplan:
Translate any page with list. Translate such a section, clear it using
"Clear paragraph", try typing to the list items. You should be able
to type there.

Alternatively, try language pairs with different directionality or
choose 'Disable machine translation'

There is some code duplication in the place the fix was made.
Deferred to another commit.

Bug: T103504
Change-Id: I52a26d67aef2e8e248565fb7f8ccc3b0b36d6571
---
M modules/translation/ext.cx.translation.js
1 file changed, 10 insertions(+), 0 deletions(-)


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

diff --git a/modules/translation/ext.cx.translation.js 
b/modules/translation/ext.cx.translation.js
index 45ffb35..3a7cf69 100644
--- a/modules/translation/ext.cx.translation.js
+++ b/modules/translation/ext.cx.translation.js
@@ -270,6 +270,11 @@
if ( $sourceSection.prop( 'tagName' ) === 
'FIGURE' ) {
// Clear figure caption alone.
$clone.find( 'figcaption' ).empty();
+   } else if ( $sourceSection.prop( 'tagName' ) 
=== 'UL' ) {
+   $clone = $sourceSection.clone();
+   // Explicit contenteditable attribute 
helps to place the cursor
+   // in empty UL.
+   $clone.prop( 'contenteditable', true 
).find( 'li' ).empty();
} else {
$clone.empty();
}
@@ -281,6 +286,11 @@
// When clearing figures, replace it 
with placeholder.
$clone = getPlaceholder( sourceId )
.attr( 'data-cx-section-type', 
$sourceSection.prop( 'tagName' ) );
+   } else if ( $sourceSection.prop( 'tagName' ) 
=== 'UL' ) {
+   $clone = $sourceSection.clone();
+   // Explicit contenteditable attribute 
helps to place the cursor
+   // in empty UL.
+   $clone.prop( 'contenteditable', true 
).find( 'li' ).empty();
} else {
$clone.empty();
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I52a26d67aef2e8e248565fb7f8ccc3b0b36d6571
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Reduce the code duplication in applyTranslationTemplate method - change (mediawiki...ContentTranslation)

2015-07-27 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Reduce the code duplication in applyTranslationTemplate method
..

Reduce the code duplication in applyTranslationTemplate method

Change-Id: If38aa7cf381cb72a136a038724d29bf38e7b6fd4
---
M modules/translation/ext.cx.translation.js
1 file changed, 11 insertions(+), 22 deletions(-)


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

diff --git a/modules/translation/ext.cx.translation.js 
b/modules/translation/ext.cx.translation.js
index f7081ea..c4365b6 100644
--- a/modules/translation/ext.cx.translation.js
+++ b/modules/translation/ext.cx.translation.js
@@ -265,39 +265,28 @@
'data-cx-state': 'source'
} );
 
-   if ( origin === 'mt-user-disabled' ) {
+   if ( origin === 'mt-user-disabled' || origin === 
'clear' ) {
$clone.attr( 'data-cx-state', 'empty' );
-   if ( $sourceSection.prop( 'tagName' ) === 
'FIGURE' ) {
-   // Clear figure caption alone.
-   $clone.find( 'figcaption' ).empty();
+   if ( $sourceSection.is( 'figure' ) ) {
+   if ( origin === 'clear' ) {
+   // When clearing figures, 
replace it with placeholder.
+   $clone = getPlaceholder( 
sourceId ).attr( 'data-cx-section-type', 'figure' );
+   } else {
+   // Clear figure caption alone.
+   $clone.find( 'figcaption' 
).empty();
+   }
} else if ( $sourceSection.is( 'ul, ol' ) ) {
$clone = $sourceSection.clone();
// Explicit contenteditable attribute 
helps to place the cursor
-   // in empty UL.
+   // in empty  or .
$clone.prop( 'contenteditable', true 
).find( 'li' ).empty();
} else {
$clone.empty();
}
}
-
-   if ( origin === 'clear' ) {
-   $clone.attr( 'data-cx-state', 'empty' );
-   if ( $sourceSection.prop( 'tagName' ) === 
'FIGURE' ) {
-   // When clearing figures, replace it 
with placeholder.
-   $clone = getPlaceholder( sourceId )
-   .attr( 'data-cx-section-type', 
$sourceSection.prop( 'tagName' ) );
-   } else if ( $sourceSection.is( 'ul, ol' ) ) {
-   $clone = $sourceSection.clone();
-   // Explicit contenteditable attribute 
helps to place the cursor
-   // in empty UL.
-   $clone.prop( 'contenteditable', true 
).find( 'li' ).empty();
-   } else {
-   $clone.empty();
-   }
-   } // else: service-failure, non-editable, 
mt-not-available
+   // else: service-failure, non-editable, mt-not-available
// Replace the placeholder with a translatable element
$section.replaceWith( $clone );
-
// $section was replaced. Get the updated instance.
$section = mw.cx.getTranslationSection( sourceId );
mw.hook( 'mw.cx.translation.postMT' ).fire( $section );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If38aa7cf381cb72a136a038724d29bf38e7b6fd4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Increase line-height for source and translation content to 1... - change (mediawiki...ContentTranslation)

2015-07-27 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Increase line-height for source and translation content to 1.5em
..

Increase line-height for source and translation content to 1.5em

Applying general typography guidelines for better readability.
Resulting font-size: 16px, line-height: 24px.

Change-Id: Ia1bef3c54737102f872c87e69250d2276b104d54
---
M modules/translationview/styles/ext.cx.translationview.less
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/modules/translationview/styles/ext.cx.translationview.less 
b/modules/translationview/styles/ext.cx.translationview.less
index 8b8e823..f897abf 100644
--- a/modules/translationview/styles/ext.cx.translationview.less
+++ b/modules/translationview/styles/ext.cx.translationview.less
@@ -65,6 +65,7 @@
}
 
.cx-column__content {
+   line-height: 1.5em;
clear: both;
word-wrap: break-word;
position: relative;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia1bef3c54737102f872c87e69250d2276b104d54
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Publish: Enable the publish button after a publish fail to r... - change (mediawiki...ContentTranslation)

2015-07-27 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Publish: Enable the publish button after a publish fail to retry
..

Publish: Enable the publish button after a publish fail to retry

When publishing error happens, the publish button is disabled.
This behavior is not correct since the error message says:
"Publishing failed, please retry". To retry publishing, the button
should be enabled.

Change-Id: I54aa727872620ccc1774b981fc64503509efd171
---
M modules/publish/ext.cx.publish.js
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/modules/publish/ext.cx.publish.js 
b/modules/publish/ext.cx.publish.js
index e8305bd..e85f3e2 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -70,8 +70,6 @@
self.onFail( 'cxpublish', response.cxpublish );
} ).fail( function ( code, details ) {
self.onFail( code, details );
-   } ).always( function () {
-   self.$trigger.prop( 'disabled', true ).text( 
mw.msg( 'cx-publish-button' ) );
} );
} );
};
@@ -307,6 +305,8 @@
 
mw.hook( 'mw.cx.error' ).fire( mw.msg( 'cx-publish-page-error' 
) );
mw.log( '[CX] Error while publishing:', code, trace );
+   // Enable the publish button for retry
+   this.$trigger.prop( 'disabled', false ).text( mw.msg( 
'cx-publish-button' ) );
};
 
/**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I54aa727872620ccc1774b981fc64503509efd171
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Provide useful error details when publishing fails - change (mediawiki...ContentTranslation)

2015-07-27 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Provide useful error details when publishing fails
..

Provide useful error details when publishing fails

From our logs, we see 4 main reasons for publishing failures.
1. Timeout. Related to network.
2. spamblacklist catching URLs in translation
3. User blocked from editing. Now we are not providing Special:CX at all for 
this
   category of users
4. Parsoid failed to convert the HTML to wikitext.

For all of these provide a brief hint in publishing error message.

Bug: T100498
Change-Id: Ia96ec15a4d44c7c1403542bdd1e25660984fad8b
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M modules/publish/ext.cx.publish.js
4 files changed, 20 insertions(+), 6 deletions(-)


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

diff --git a/extension.json b/extension.json
index c20fdb5..ea27279 100644
--- a/extension.json
+++ b/extension.json
@@ -631,7 +631,8 @@
"cx-publish-page-success",
"cx-publish-page-error",
"cx-publish-button-publishing",
-   "cx-publish-captcha-title"
+   "cx-publish-captcha-title",
+   "unknown-error"
]
},
"ext.cx.wikibase.link": {
diff --git a/i18n/en.json b/i18n/en.json
index a965998..304ce59 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -28,7 +28,7 @@
"cx-header-all-translations": "All translations",
"cx-source-view-page": "view page",
"cx-publish-page-success": "Page published at $1",
-   "cx-publish-page-error": "An error occurred while saving the page. 
Please try to publish the page again.",
+   "cx-publish-page-error": "An error occurred while publishing the 
translation. Please try to publish the page again. Error: $1",
"cx-publish-button": "Publish translation",
"cx-publish-button-publishing": "Publishing...",
"cx-publish-summary": "Created by translating the page \"$1\"",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 2a2ded0..049b7b1 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -33,7 +33,7 @@
"cx-header-all-translations": "A link at the top of the translation 
interface to the main Special:ContentTranslation page that lists all 
translations by the user.\n{{Identical|All translations}}",
"cx-source-view-page": "A link that points to the source page under the 
heading of the source column.\n{{Identical|View page}}",
"cx-publish-page-success": "Message shown when page is published 
successfully. Parameters:\n* $1 - Link to the published page",
-   "cx-publish-page-error": "Error message to display when page saving 
fails.",
+   "cx-publish-page-error": "Error message to display when page saving 
fails.\n* $1 - Error details",
"cx-publish-button": "Publish button text in 
[[Special:ContentTranslation]].\n\nAlso used in 
{{msg-mw|Cx-tools-instructions-text6}}.",
"cx-publish-button-publishing": "Publish button text in 
[[Special:ContentTranslation]], shown while publishing is in progress. Replaces 
{{msg-mw|cx-publish-button}}.\n{{Identical|Publishing}}",
"cx-publish-summary": "This is an automatic edit summary for pages that 
were created by [[Special:ContentTranslation]].\n\nParameters:\n* $1 - the 
source page name",
diff --git a/modules/publish/ext.cx.publish.js 
b/modules/publish/ext.cx.publish.js
index b658e28..de38895 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -289,7 +289,8 @@
 * @param {object} details
 */
CXPublish.prototype.onFail = function ( code, details ) {
-   var trace = {
+   var trace, error;
+   trace = {
sourceLanguage: mw.cx.sourceLanguage,
targetLanguage: mw.cx.targetLanguage,
sourceTitle: mw.cx.sourceTitle,
@@ -305,8 +306,20 @@
this.targetTitle,
JSON.stringify( details )
);
-
-   mw.hook( 'mw.cx.error' ).fire( mw.msg( 'cx-publish-page-error' 
) );
+   // Try providing useful error information.
+   error = mw.msg( 'unknown-error' );
+   if ( details.error && details.error.info ) {
+   // 
{"servedby":"mw","error":{"code":"blocked","info":"You have been blocked 
from editing",
+   // "*":"See ..
+   error = details.error.info;
+   } else if ( details.edit ) {
+   // 
{"result":"error","edit":{"spamblacklist":"facebook.com","result":"Failure"}}
+   error = JSON.stringify( details.edit )

[MediaWiki-commits] [Gerrit] Lineardoc: Fix the reference parsing - change (mediawiki...cxserver)

2015-07-28 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Lineardoc: Fix the reference parsing
..

Lineardoc: Fix the reference parsing

Parsoid started to output references in the following format:


[4]



And, our lineardoc started to wrongly output the content as



[4]




The extra  tag is problematic and causes references appearing twice
in CX translation interface.

The extra  was a regression introduced in 
I4cca925cb35a00fa27fd31380fae90e1c4c2767f,
it's test had to correct too.

While processing inline annotation tags like above, we were skipping the 
internal
inline empty spans and that was fixed in 
I4cca925cb35a00fa27fd31380fae90e1c4c2767f

But, when we started processing the internal annotations, we were inserting
a new inline content when there is non-whitespace content. But that caused
inserting inline content in unwanted situations too. The above example shows an
 tag inserted in that way. Making the conditions for this insertion a bit 
more
stricter found working. We are checking if those inline annotations are having
any of data-mw, data-parsoid attributes. Eventhough I am not 100% sure that is
the correct solution to meet any future changes like this.

Added tests with new reference structure. The parsoid DOM spec
https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Ref_and_References
does not seem to reflect this change.

Bug: T107140
Change-Id: I68bd92ecf4190f62db9b715f66f63cfada3aea57
---
M lineardoc/Builder.js
M tests/lineardoc/LinearDoc.test.js
M tests/lineardoc/data/test3-result.xhtml
M tests/lineardoc/data/test3-result.xml
A tests/lineardoc/data/test4-result.xhtml
A tests/lineardoc/data/test4-result.xml
A tests/lineardoc/data/test4.xhtml
7 files changed, 21 insertions(+), 9 deletions(-)


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

diff --git a/lineardoc/Builder.js b/lineardoc/Builder.js
index 8874681..fe33c12 100644
--- a/lineardoc/Builder.js
+++ b/lineardoc/Builder.js
@@ -83,7 +83,7 @@
}
whitespace.push( textChunk.text );
}
-   if ( replace ) {
+   if ( replace && ( tag.attributes[ 'data-mw' ] ||  tag.attributes[ 
'data-parsoid' ]  ) ) {
// truncate list and add data span as new sub-Doc.
this.textChunks.length = i + 1;
whitespace.reverse();
diff --git a/tests/lineardoc/LinearDoc.test.js 
b/tests/lineardoc/LinearDoc.test.js
index 13a1007..98e4f41 100644
--- a/tests/lineardoc/LinearDoc.test.js
+++ b/tests/lineardoc/LinearDoc.test.js
@@ -6,7 +6,7 @@
 QUnit.test( 'LinearDoc tests', function ( assert ) {
var parser, testXhtmlFile, resultXmlFile, resultXhtmlFile, testXhtml, 
resultXml,
resultXhtml, i,
-   numTests = 3;
+   numTests = 4;
QUnit.expect( 2 * numTests );
for ( i = 1; i <= numTests; i++ ) {
testXhtmlFile = __dirname + '/data/test' + i + '.xhtml';
diff --git a/tests/lineardoc/data/test3-result.xhtml 
b/tests/lineardoc/data/test3-result.xhtml
index d6ac7fa..ae458bc 100644
--- a/tests/lineardoc/data/test3-result.xhtml
+++ b/tests/lineardoc/data/test3-result.xhtml
@@ -6,7 +6,7 @@
 
 
 
-↑ 

+↑ 

 http://lhermanto-resepkeluarga.blogspot.com/2008/04/telor-bumbu-bali-bali-seasoning.html";
 rel="mw:ExtLink">
 
 
diff --git a/tests/lineardoc/data/test3-result.xml 
b/tests/lineardoc/data/test3-result.xml
index f0bc5b3..92c83e4 100644
--- a/tests/lineardoc/data/test3-result.xml
+++ b/tests/lineardoc/data/test3-result.xml
@@ -27,12 +27,6 @@
 
   

   ↑ 
-  
-
-
-
-
-  
   

   
 
diff --git a/tests/lineardoc/data/test4-result.xhtml 
b/tests/lineardoc/data/test4-result.xhtml
new file mode 100644
index 000..c2ecf48
--- /dev/null
+++ b/tests/lineardoc/data/test4-result.xhtml
@@ -0,0 +1,2 @@
+[4]
diff --git a/tests/lineardoc/data/test4-result.xml 
b/tests/lineardoc/data/test4-result.xml
new file mode 100644
index 000..1f825b3
--- /dev/null
+++ b/tests/lineardoc/data/test4-result.xml
@@ -0,0 +1,11 @@
+
+
+  
+
+
+  [4]
+
+
+  
+
+
diff --git a/tests/lineardoc/data/test4.xhtml b/tests/lineardoc/data/test4.xhtml
new file mode 100644
index 000..951e145
--- /dev/null
+++ b/tests/lineardoc/data/test4.xhtml
@@ -0,0 +1,5 @@
+[4]

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I68bd92ecf4190f62db9b715f66f63cfada3aea57
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/cxserver
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Do not show the article selector unless all params passed in... - change (mediawiki...ContentTranslation)

2015-07-28 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Do not show the article selector unless all params passed in URL
..

Do not show the article selector unless all params passed in URL

It seems showing this dialog even with partially fillted params(
for example, contribution menu entry point fills the target lang param)
creates confusion to users and they re-type title and end up in creating
a fresh translation that overwrites an in-progress translation

Bug: T104702
Change-Id: Iff73f4bedbb1038d70ca26e087550ddb64261220
---
M modules/source/ext.cx.source.selector.js
1 file changed, 3 insertions(+), 3 deletions(-)


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

diff --git a/modules/source/ext.cx.source.selector.js 
b/modules/source/ext.cx.source.selector.js
index f32d532..74fc172 100644
--- a/modules/source/ext.cx.source.selector.js
+++ b/modules/source/ext.cx.source.selector.js
@@ -100,10 +100,10 @@
this.$targetTitleInput.val( this.options.targetTitle 
).trigger( 'input' );
}
 
-   // If any of the values are already present,
+   // If all of the values are already present,
// show the dialog and initiate a validation.
-   if ( this.options.sourceLanguage || this.options.targetLanguage 
||
-   this.options.sourceTitle || this.options.targetTitle
+   if ( this.options.sourceLanguage && this.options.targetLanguage 
&&
+   this.options.sourceTitle && this.options.targetTitle
) {
this.show();
this.check();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iff73f4bedbb1038d70ca26e087550ddb64261220
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Improve reference adaptation to avoid parsoid errors - change (mediawiki...ContentTranslation)

2015-07-28 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Improve reference adaptation to avoid parsoid errors
..

Improve reference adaptation to avoid parsoid errors

The current reference adaptation does not guarantee that the adapted
reference has valid data-mw attribute. Parsoid demands a valid id
in data-mw.body pointing to an item in references section. Not having
that cause parsoid errors during  HTML to wikitext conversion. It does not
cause parsoid to fail, but generated articles with errors as shown in
Bug T107252.

This patch improves and cleans up the parsoid adaptation process.
And it make sure a valid data-mw is present in the adapted reference.

Testplan:
Translate Vaporwave article from English to Spanish. Use MT for all
sections and publish. The published page should not have any errors about
references. Compare it with 
https://es.wikipedia.org/w/index.php?title=Vaporwave&oldid=84053572

Make sure reference card is working for all references and adding reference at
cursor position also works.
Repeat the test for translating Attack & Release article from en to es
and compare result with 
https://es.wikipedia.org/w/index.php?title=Attack_%26_Release&oldid=84052884

Bug: T107252
Change-Id: I0ab01b682a54ac3a96a52068740af85964e99807
---
M modules/tools/ext.cx.tools.reference.js
1 file changed, 43 insertions(+), 55 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.reference.js 
b/modules/tools/ext.cx.tools.reference.js
index 901eb94..2169885 100644
--- a/modules/tools/ext.cx.tools.reference.js
+++ b/modules/tools/ext.cx.tools.reference.js
@@ -128,7 +128,7 @@
 * See https://phabricator.wikimedia.org/T88290
 * and 
https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Ref_and_References
 * @param {string} referenceId The reference element Identifier.
-* @return {string} The HTML content of the reference.
+* @return {string|null} The HTML content of the reference.
 */
ReferenceCard.prototype.getReferenceContent = function ( referenceId ) {
var reference, referenceContentElement;
@@ -138,7 +138,7 @@
return null;
}
// Support traditional reference handling by Parsoid
-   if ( reference.body.html ) {
+   if ( reference.body && reference.body.html ) {
return reference.body.html;
}
 
@@ -226,28 +226,11 @@
/**
 * For the given reference id, get the reference data
 *
-* This is very easy in the cases one reference used only once in the 
page.
-* Such a reference link will have data-mw carrying the data.
-*
-* But when the same reference used in multiple places, this is tricky.
-* The page will have the following markup(example) at the end of page, 
saying all these 3
-* references are same. One of these links will have reference data. 
Not necessarily
-* first one. So we have to iterate through all these siblings and find 
which one has
-* reference data.
-*
-* Example from Antipasto article from eswiki:
-* 
-* ↑
-* 1.0
-* 1.1
-* 1.2
-* 
-* 
 * @param {string} referenceId
 * @return {Object|null}
 */
ReferenceCard.prototype.getReferenceData = function ( referenceId ) {
-   var $sourceReference, i, mwData, $sibling, $referenceSiblings, 
id;
+   var $sourceReference;
 
$sourceReference = $( document.getElementById( referenceId ) );
if ( !$sourceReference.is( '[typeof*="mw:Extension/ref"]' ) ) {
@@ -255,22 +238,7 @@
return null;
}
 
-   $referenceSiblings = $( '[typeof*="mw:Extension/references"]' )
-   .find( 'a[href="#' + referenceId + '"]' )
-   .siblings()
-   .addBack(); // Including self
-
-   for ( i = 0; i < $referenceSiblings.length; i++ ) {
-   id = $( $referenceSiblings[ i ] ).attr( 'href' 
).replace( '#', '' );
-   $sibling = $( document.getElementById( id ) );
-   mwData = $sibling.data( 'mw' );
-   if ( mwData && mwData.body ) {
-   return mwData;
-   }
-   }
-
-   // Did not see a case where we still not find reference data, 
but...
-   return null;
+   return $sourceReference.data( 'mw' );
};
 
/**
@@ -278,36 +246,56 @@
 * See 
https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Ref_and_References
  

[MediaWiki-commits] [Gerrit] Corrections for draft restore based on permanent ids - change (mediawiki...ContentTranslation)

2015-07-29 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Corrections for draft restore based on permanent ids
..

Corrections for draft restore based on permanent ids

* The translation column may not be ready when draft module initilize
  this.$translation because draft module is loaded in parallel with source.
  This can cause, incorrect draft restore. Fixed that.

* Update the data-source attributes correctly in draft restore
  Icc5dff9ba5cf79c599021f2a633024a257b397fb missed to update the data-source
  attributes when sections are restored. This causes progress calculation
  going wrong.

* Updated the tests accordingly

Change-Id: I6406e43cbfef1c83f6f0de7b6fe9874a20f43d60
---
M modules/draft/ext.cx.draft.js
M tests/qunit/draft/ext.cx.draft.test.js
2 files changed, 52 insertions(+), 29 deletions(-)


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

diff --git a/modules/draft/ext.cx.draft.js b/modules/draft/ext.cx.draft.js
index 9424f13..f5881fd 100644
--- a/modules/draft/ext.cx.draft.js
+++ b/modules/draft/ext.cx.draft.js
@@ -19,8 +19,8 @@
this.draftId = draftId;
this.$draft = null;
this.disabled = false;
-   this.$source = $( '.cx-column--source .cx-column__content' );
-   this.$translation = $( '.cx-column--translation 
.cx-column__content' );
+   this.$source = null;
+   this.$translation = null;
this.init();
this.listen();
}
@@ -44,6 +44,9 @@
ContentTranslationDraft.prototype.getContent = function () {
var $content;
 
+   if ( !this.$translation.length ) {
+   this.$translation = $( '.cx-column--translation 
.cx-column__content' );
+   }
$content = this.$translation.clone();
// Remove placeholder sections
$content.find( '.placeholder' ).remove();
@@ -169,11 +172,11 @@
 * @param {jQuery} $section Add it before/after this section.
 * @param {string} afterOrBefore Whether the orphan to be added after 
or before $section.
 */
-   function addOrphanTranslation( $translation, $section, afterOrBefore ) {
+   ContentTranslationDraft.prototype.addOrphanTranslation = function ( 
$translation, $section, afterOrBefore ) {
// Add a dummy source section
var $dummySourceSection = $( '<' + $translation.prop( 'tagName' 
) + '>' )
.css( 'height', 1 ) // Non-zero height to avoid it 
ignored by keepAlignment plugin.
-   .prop( 'id', $translation.data( 'source' ) );
+   .attr( 'id', $translation.data( 'source' ) );
 
if ( afterOrBefore === 'after' ) {
$( '#' + $section.data( 'source' ) ).after( 
$dummySourceSection );
@@ -184,26 +187,39 @@
}
// Annotate the section to indicate it was restored from draft
// so that certain adaptations can be skipped.
-   $translation.attr( 'data-cx-draft', true ).keepAlignment();
+   $translation.attr( {
+   'data-cx-draft': true,
+   'data-source': $dummySourceSection.prop( 'id' )
+   } ).keepAlignment();
mw.hook( 'mw.cx.translation.postMT' ).fire( $translation );
-   }
+   };
 
/**
 * Restore this draft to the appropriate placeholders
 */
ContentTranslationDraft.prototype.restore = function () {
-   var i, j, $draftSection, sectionId, $section,
+   var i, j, $draftSection, sectionId, $section, $sourceSection,
$placeholderSection, orphans = [],
$lastPlaceholder;
 
+   // We cannot populate this early because this ext.cx.draft 
modules may be loaded before
+   // source and target is ready.
+   if ( !this.$source.length ) {
+   this.$source = $( '.cx-column--source 
.cx-column__content' );
+   }
+   if ( !this.$translation.length ) {
+   this.$translation = $( '.cx-column--translation 
.cx-column__content' );
+   }
for ( i = 0; i < this.$draft.length; i++ ) {
$draftSection = $( this.$draft[ i ] );
sectionId = $draftSection.prop( 'id' );
$placeholderSection = this.$translation.find( '#' + 
sectionId );
+   $sourceSection = this.$source.find( '#' + 
$placeholderSection.data( 'source' ) );
if ( !$placeholderSection.length ) {
// Support old sections with sequential 
idendifiers
+ 

[MediaWiki-commits] [Gerrit] Add support for - change (mediawiki...ContentTranslation)

2015-07-30 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Add support for 
..

Add support for 

Testplan:
Use enwiki Integral article for testing. The first equation in that
page has \int_a^b \! f(x)\,dx
and it should be transferred to target article without any issues.

Bug: T106715
Change-Id: I752b4c72581c599b8602c5ebd8e241ca10d92978
---
M modules/publish/ext.cx.publish.js
M modules/tools/ext.cx.tools.images.js
2 files changed, 11 insertions(+), 4 deletions(-)


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

diff --git a/modules/publish/ext.cx.publish.js 
b/modules/publish/ext.cx.publish.js
index 03a17e4..d4af0f5 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -365,7 +365,7 @@
} );
 
// Remove empty sections
-   if ( !$.trim( $section.text() ) ) {
+   if ( !$.trim( $section.text() && 
!$section.children().length ) ) {
$section.remove();
}
} );
diff --git a/modules/tools/ext.cx.tools.images.js 
b/modules/tools/ext.cx.tools.images.js
index 14286c9..10c597d 100644
--- a/modules/tools/ext.cx.tools.images.js
+++ b/modules/tools/ext.cx.tools.images.js
@@ -92,13 +92,17 @@
var targetLanguage = mw.cx.targetLanguage;
 
$section.find( 'img' ).each( function () {
-   var $image = $( this );
+   var $sourceSection, $sourceImage, $image = $( this );
 
+   $sourceSection = mw.cx.getSourceSection( $section.data( 
'source' ) );
+   $sourceImage = $sourceSection.find( '#' + $image.prop( 
'id' ) );
$image.on( 'click', function ( event ) {
// Avoid opening images by clicking.
event.preventDefault();
} );
-
+   // Copy data-mw if any from source image.
+   // Math extension, for example, carry the equation to 
render in its data-mw
+   $image.attr( 'data-mw', $sourceImage.attr( 'data-mw' ) 
);
getImageNamespaceTranslation( targetLanguage )
.done( function ( translatedNamespace ) {
var resource;
@@ -109,7 +113,10 @@
if ( resource ) {
resource = resource.replace( 
/(\.\/)*(.+)(:)/g,
'$1' + 
translatedNamespace + '$3' );
-   $image.attr( 'resource', 
resource );
+   $image.prop( {
+   resource: resource,
+   id: 'cx' + 
$sourceImage.prop( 'id' )
+   } );
// If the image has a parent 
link, correct its link target
$image.parents( 'a' ).attr( 
'href', resource );
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I752b4c72581c599b8602c5ebd8e241ca10d92978
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Use .attr() to set the resource attribute of image, while ad... - change (mediawiki...ContentTranslation)

2015-08-07 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Use .attr() to set the resource attribute of image, while 
adapting
..

Use .attr() to set the resource attribute of image, while adapting

Bug: T108302
Change-Id: Ic427e91928d95502a71e089b58f4c1c1673766e0
---
M modules/tools/ext.cx.tools.images.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/tools/ext.cx.tools.images.js 
b/modules/tools/ext.cx.tools.images.js
index 10c597d..08a7190 100644
--- a/modules/tools/ext.cx.tools.images.js
+++ b/modules/tools/ext.cx.tools.images.js
@@ -113,7 +113,7 @@
if ( resource ) {
resource = resource.replace( 
/(\.\/)*(.+)(:)/g,
'$1' + 
translatedNamespace + '$3' );
-   $image.prop( {
+   $image.attr( {
resource: resource,
id: 'cx' + 
$sourceImage.prop( 'id' )
} );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic427e91928d95502a71e089b58f4c1c1673766e0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Templates: Do not skip adapting inner templates if parent is... - change (mediawiki...ContentTranslation)

2015-08-09 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Templates: Do not skip adapting inner templates if parent is 
template
..

Templates: Do not skip adapting inner templates if parent is template

We were not adapting templates inside a template. Most of the cases
such complex template adaptation attempts will not succeed. But there
is a where this adaptation can succeed and required for references

This particular case was found while analysing the publishing error
for article Amblydoras from en to es.

Testplan:
Translate Amblydoras from en to es. Start adding sections from top
to bottom. You will see references section added. Try publishing it.
Publishing will pass. This is normal case. Now translate the same
again and start clicking sections from bottom to top. That means,
you are adding references list first and then section containing reference
later. Try publishing. You will get parsoid error. With this patch,
adding sections in any order will not result publishing error.

Change-Id: If9ab5a98ae49b379c01f57a38f0b08c4e3fad122
---
M modules/tools/ext.cx.tools.template.js
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.template.js 
b/modules/tools/ext.cx.tools.template.js
index 1ac181b..5833b21 100644
--- a/modules/tools/ext.cx.tools.template.js
+++ b/modules/tools/ext.cx.tools.template.js
@@ -213,9 +213,9 @@
 
if ( $section.is( '[typeof*="mw:Transclusion"]' ) ) {
templates.push( $section );
-   } else {
-   templates = $section.find( 
'[typeof*="mw:Transclusion"]' );
}
+   templates.push( $section.find( '[typeof*="mw:Transclusion"]' ) 
);
+
$.each( templates, function () {
var template = new TemplateTool( this );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If9ab5a98ae49b379c01f57a38f0b08c4e3fad122
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Change the id of source title so that its prefix is same as ... - change (mediawiki...ContentTranslation)

2015-08-11 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Change the id of source title so that its prefix is same as 
parsoid ids
..

Change the id of source title so that its prefix is same as parsoid ids

Recently we moved to parsoid generated Ids and our id validations
changed. But the id of source title did not change accordingly and
it broke the connection between source and target title elements

And then it caused breakage of dynamic alignment of titles

In this patch we keep the id prefix as mw.

Testplan:
Start a translation, In the target title, type some text that is so
long that it cause line break. Observe if the titles of source and
translation aligns dynamically.

Bug: T108524
Change-Id: I02a1af3f2b8d00cb54c099f4c91c335d736d69a0
---
M modules/source/ext.cx.source.js
M modules/translation/ext.cx.translation.js
2 files changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/modules/source/ext.cx.source.js b/modules/source/ext.cx.source.js
index d7efeea..d0b7d8f 100644
--- a/modules/source/ext.cx.source.js
+++ b/modules/source/ext.cx.source.js
@@ -107,7 +107,7 @@
 
this.$title = $( '' )
.attr( {
-   id: 'cx-source-title'
+   id: 'mwcx-source-title'
} )
.addClass( 'cx-column__title' )
.text( mw.cx.sourceTitle );
diff --git a/modules/translation/ext.cx.translation.js 
b/modules/translation/ext.cx.translation.js
index 41e5247..fcc2c13 100644
--- a/modules/translation/ext.cx.translation.js
+++ b/modules/translation/ext.cx.translation.js
@@ -59,7 +59,7 @@
 
$heading = $( '' )
.attr( {
-   'data-source': 'cx-source-title',
+   'data-source': 'mwcx-source-title',
contenteditable: true
} )
.addClass( 'cx-column__title' )

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I02a1af3f2b8d00cb54c099f4c91c335d736d69a0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Images: validate image id before adapting to prevent js error - change (mediawiki...ContentTranslation)

2015-08-12 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Images: validate image id before adapting to prevent js error
..

Images: validate image id before adapting to prevent js error

Images not having an identifier can cause js error and can even
prevent any auto save happening further.

Testplan:
Translate enwiki:Amblydoras to es. Add the last section about
stub article. Console will show a js error and adding any other
secton after this won't trigger autosave. With this patch, there
should not be a js error and save should work as expected.

Change-Id: I18affd6927d391469db9e1c6445fa98a4f760f5c
---
M modules/tools/ext.cx.tools.images.js
1 file changed, 6 insertions(+), 2 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.images.js 
b/modules/tools/ext.cx.tools.images.js
index 08a7190..bb10b82 100644
--- a/modules/tools/ext.cx.tools.images.js
+++ b/modules/tools/ext.cx.tools.images.js
@@ -92,10 +92,14 @@
var targetLanguage = mw.cx.targetLanguage;
 
$section.find( 'img' ).each( function () {
-   var $sourceSection, $sourceImage, $image = $( this );
+   var imageId, $sourceSection, $sourceImage, $image = $( 
this );
 
+   imageId = $image.prop( 'id' );
+   if ( !imageId ) {
+   return;
+   }
$sourceSection = mw.cx.getSourceSection( $section.data( 
'source' ) );
-   $sourceImage = $sourceSection.find( '#' + $image.prop( 
'id' ) );
+   $sourceImage = $sourceSection.find( '#' + imageId );
$image.on( 'click', function ( event ) {
// Avoid opening images by clicking.
event.preventDefault();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I18affd6927d391469db9e1c6445fa98a4f760f5c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Load style for Style Parsoid output along with source RL module - change (mediawiki...ContentTranslation)

2015-04-07 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Load style for Style Parsoid output along with source RL module
..

Load style for Style Parsoid output along with source RL module

This allows us to just fetch the HTML body of source article instead
of loading the full HTML with unnecessary data for CX.

Other than this style, CX internally applies some style modification
to fit the content in CX UI. For example, tables styles. We can club
all these content styles to a single ext.cx.content.style RL module
in future. Now those style modifications are not properly organized.

Also see I1d5c1e0764f67

Change-Id: I3068ba6f108f11024f2811360734ebe02d2ce461
---
M Resources.php
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/Resources.php b/Resources.php
index 61b2af2..fc8428e 100644
--- a/Resources.php
+++ b/Resources.php
@@ -187,6 +187,7 @@
'mediawiki.jqueryMsg',
'mediawiki.util',
'ext.cx.widgets.spinner',
+   'mediawiki.skinning.content.parsoid',
),
'messages' => array(
'cx-source-view-page',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3068ba6f108f11024f2811360734ebe02d2ce461
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Move the highlighting related styles to a separate LESS file - change (mediawiki...ContentTranslation)

2015-04-07 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Move the highlighting related styles to a separate LESS file
..

Move the highlighting related styles to a separate LESS file

It was duplicated in source and translation modules

Change-Id: I2692ce19d6c55b12d90edac464514167bf64010d
---
M modules/source/styles/ext.cx.source.less
M modules/translation/styles/ext.cx.translation.less
A modules/widgets/common/ext.cx.highlight.less
3 files changed, 26 insertions(+), 50 deletions(-)


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

diff --git a/modules/source/styles/ext.cx.source.less 
b/modules/source/styles/ext.cx.source.less
index 551bb62..7207a96 100644
--- a/modules/source/styles/ext.cx.source.less
+++ b/modules/source/styles/ext.cx.source.less
@@ -1,8 +1,5 @@
 @import "../../widgets/common/ext.cx.common";
-
-@text-highlight-color: #FEFCE0;
-@link-highlight-color: #BDD4FF;
-@connected-link-highlight-color: #D9E6FF;
+@import "../../widgets/common/ext.cx.highlight";
 
 .cx-column--source {
.cx-column__language-label,
@@ -19,27 +16,6 @@
 
.cx-column__sub-heading__view-page {
.mw-ui-two-thirds;
-   }
-
-   .cx-highlight {
-   background-color: @text-highlight-color;
-   box-shadow: 0px 0px 0 2px @text-highlight-color;
-   border-radius: 2px;
-   transition: all 0.25s;
-   }
-
-   .cx-highlight--blue {
-   background-color: @link-highlight-color;
-   box-shadow: 0px 0px 0 2px @link-highlight-color;
-   border-radius: 2px;
-   transition: all 0.25s;
-   }
-
-   .cx-highlight--lightblue {
-   background-color: @connected-link-highlight-color;
-   box-shadow: 0px 0px 0 2px @connected-link-highlight-color;
-   border-radius: 2px;
-   transition: all 0.25s;
}
 }
 
diff --git a/modules/translation/styles/ext.cx.translation.less 
b/modules/translation/styles/ext.cx.translation.less
index 35c2417..6c77190 100644
--- a/modules/translation/styles/ext.cx.translation.less
+++ b/modules/translation/styles/ext.cx.translation.less
@@ -1,8 +1,5 @@
 @import "../../widgets/common/ext.cx.common";
-
-@text-highlight-color: #FEFCE0;
-@link-highlight-color: #BDD4FF;
-@connected-link-highlight-color: #D9E6FF;
+@import "../../widgets/common/ext.cx.highlight";
 
 .cx-column--translation {
[contenteditable] {
@@ -11,27 +8,6 @@
 
[data-editable=false] {
 background-image: repeating-linear-gradient(135deg,#eee,#eee 
5px,#ddd 5px,#ddd 10px);
-   }
-
-   .cx-highlight {
-   background-color: @text-highlight-color;
-   box-shadow: 0px 0px 0 2px @text-highlight-color;
-   border-radius: 2px;
-   transition: all 0.25s;
-   }
-
-   .cx-highlight--blue {
-   background-color: @link-highlight-color;
-   box-shadow: 0px 0px 0 2px @link-highlight-color;
-   border-radius: 2px;
-   transition: all 0.25s;
-   }
-
-   .cx-highlight--lightblue {
-   background-color: @connected-link-highlight-color;
-   box-shadow: 0px 0px 0 2px @connected-link-highlight-color;
-   border-radius: 2px;
-   transition: all 0.25s;
}
 }
 
diff --git a/modules/widgets/common/ext.cx.highlight.less 
b/modules/widgets/common/ext.cx.highlight.less
new file mode 100644
index 000..f339809
--- /dev/null
+++ b/modules/widgets/common/ext.cx.highlight.less
@@ -0,0 +1,24 @@
+@text-highlight-color: #FEFCE0;
+@link-highlight-color: #BDD4FF;
+@connected-link-highlight-color: #D9E6FF;
+
+.cx-highlight {
+   background-color: @text-highlight-color;
+   box-shadow: 0px 0px 0 2px @text-highlight-color;
+   border-radius: 2px;
+   transition: all 0.25s;
+}
+
+.cx-highlight--blue {
+   background-color: @link-highlight-color;
+   box-shadow: 0px 0px 0 2px @link-highlight-color;
+   border-radius: 2px;
+   transition: all 0.25s;
+}
+
+.cx-highlight--lightblue {
+   background-color: @connected-link-highlight-color;
+   box-shadow: 0px 0px 0 2px @connected-link-highlight-color;
+   border-radius: 2px;
+   transition: all 0.25s;
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2692ce19d6c55b12d90edac464514167bf64010d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Remove unwanted link highlight code from translation module - change (mediawiki...ContentTranslation)

2015-04-07 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Remove unwanted link highlight code from translation module
..

Remove unwanted link highlight code from translation module

The links are highlighted using blue colors and not with yellow.
The highlighting code is present in links module. This is old code
left in translation module

Change-Id: I4d78b6a62f8e2b962d35fcd5ffc07979dcd89b53
---
M modules/translation/ext.cx.translation.js
1 file changed, 0 insertions(+), 6 deletions(-)


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

diff --git a/modules/translation/ext.cx.translation.js 
b/modules/translation/ext.cx.translation.js
index e64f469..00d1f9f 100644
--- a/modules/translation/ext.cx.translation.js
+++ b/modules/translation/ext.cx.translation.js
@@ -137,12 +137,6 @@
}
} );
 
-   // Highlight corresponding links in source and translation 
columns
-   this.$container.on( 'mouseenter mouseleave', 'a', function () {
-   $( '[data-linkid="' + $( this ).data( 'linkid' ) + '"]' 
)
-   .toggleClass( 'cx-highlight' );
-   } );
-
// Highlight segment pairs
this.$container.on( 'mouseenter mouseleave', '.cx-segment', 
function () {
var $segment = $( this ),

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4d78b6a62f8e2b962d35fcd5ffc07979dcd89b53
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Remove highlighting classes before saving the translation - change (mediawiki...ContentTranslation)

2015-04-07 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Remove highlighting classes before saving the translation
..

Remove highlighting classes before saving the translation

Bug: T95394
Change-Id: I03104c14c6cbf86f30e1086d163213ee1fced01a
---
M modules/draft/ext.cx.draft.js
1 file changed, 4 insertions(+), 0 deletions(-)


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

diff --git a/modules/draft/ext.cx.draft.js b/modules/draft/ext.cx.draft.js
index bb749ae..fe2e8f6 100644
--- a/modules/draft/ext.cx.draft.js
+++ b/modules/draft/ext.cx.draft.js
@@ -218,6 +218,10 @@
.remove();
// Remove placeholder sections
$content.find( '.placeholder' ).remove();
+   // Remove all highlighting before saving
+   $content
+   .find( '.cx-highlight, .cx-highlight--blue, 
.cx-highlight--lightblue' )
+   .removeClass( 'cx-highlight cx-highlight--blue 
cx-highlight--lightblue' );
return $content.html();
}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I03104c14c6cbf86f30e1086d163213ee1fced01a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add simple English as source and target language - change (mediawiki...cxserver)

2015-04-09 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Add simple English as source and target language
..

Add simple English as source and target language

Use Apertium for this just like English

Bug: T95538
Change-Id: I5b1ef7e9fbd0cad514f890df93c16ca572e2c40e
---
M config.defaults.js
M mt/Apertium.languagenames.json
2 files changed, 4 insertions(+), 2 deletions(-)


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

diff --git a/config.defaults.js b/config.defaults.js
index b3a9e59..ff5e2be 100644
--- a/config.defaults.js
+++ b/config.defaults.js
@@ -22,8 +22,8 @@
cert: null,
// Service registry
registry: {
-   source: [ 'af', 'an', 'ar', 'az', 'bg', 'bs', 'ca', 'cr', 'cy', 
'en', 'eo', 'es', 'fr', 'gl', 'gu', 'hi', 'hr', 'id', 'ja', 'kk', 'km', 'kn', 
'ky', 'kz', 'min', 'mk', 'ms', 'mt', 'nl', 'no', 'nn', 'oc', 'pa', 'pl', 'pt', 
'ru', 'sh', 'sl', 'tr', 'tt', 'uk', 'ur', 'uz', 'vi', 'xh', 'zh' ],
-   target: [ 'af', 'an', 'ar', 'az', 'bg', 'bs', 'ca', 'cr', 'cy', 
'eo', 'es', 'fr', 'gl', 'gu', 'hi', 'hr', 'id', 'ja', 'kk', 'km', 'kn', 'ky', 
'kz', 'min', 'mk', 'ms', 'mt', 'nl', 'no', 'nn', 'oc', 'pa', 'pl', 'pt', 'ru', 
'sh', 'sl', 'tt', 'tr', 'uk', 'ur', 'uz', 'vi', 'xh', 'zh' ],
+   source: [ 'af', 'an', 'ar', 'az', 'bg', 'bs', 'ca', 'cr', 'cy', 
'en', 'eo', 'es', 'fr', 'gl', 'gu', 'hi', 'hr', 'id', 'ja', 'kk', 'km', 'kn', 
'ky', 'kz', 'min', 'mk', 'ms', 'mt', 'nl', 'no', 'nn', 'oc', 'pa', 'pl', 'pt', 
'ru', 'sh', 'simple', 'sl', 'tr', 'tt', 'uk', 'ur', 'uz', 'vi', 'xh', 'zh' ],
+   target: [ 'af', 'an', 'ar', 'az', 'bg', 'bs', 'ca', 'cr', 'cy', 
'eo', 'es', 'fr', 'gl', 'gu', 'hi', 'hr', 'id', 'ja', 'kk', 'km', 'kn', 'ky', 
'kz', 'min', 'mk', 'ms', 'mt', 'nl', 'no', 'nn', 'oc', 'pa', 'pl', 'pt', 'ru', 
'sh', 'simple', 'sl', 'tt', 'tr', 'uk', 'ur', 'uz', 'vi', 'xh', 'zh' ],
mt: {
Apertium: {
af: [ 'nl' ],
@@ -53,6 +53,7 @@
pt: [ 'ca', 'es', 'gl' ],
ro: [ 'es' ],
sh: [ 'mk', 'sl' ],
+   simple: [ 'bs', 'ca', 'cr', 'eo', 'es', 'gl', 
'hr', 'sh', 'sr' ],
sl: [ 'bs', 'cr', 'hr', 'sh', 'sr' ],
sv: [ 'da', 'is' ],
tt: [ 'kk' ],
diff --git a/mt/Apertium.languagenames.json b/mt/Apertium.languagenames.json
index a233ef1..8da56c9 100644
--- a/mt/Apertium.languagenames.json
+++ b/mt/Apertium.languagenames.json
@@ -32,6 +32,7 @@
"pt": "por",
"ro": "ron",
"sh": "hbs",
+   "simple": "eng",
"sl": "slv",
"sr": "hbs_SR",
"sv": "swe",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5b1ef7e9fbd0cad514f890df93c16ca572e2c40e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/cxserver
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] When parsoid fails, throw exception with status - change (mediawiki...ContentTranslation)

2015-04-08 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: When parsoid fails, throw exception with status
..

When parsoid fails, throw exception with status

$req->getContent() does not have anything. So having that in
exception is useless

Change-Id: I2507840c32f853cf15100fe42f899675e2f149ed
---
M api/ApiContentTranslationPublish.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/api/ApiContentTranslationPublish.php 
b/api/ApiContentTranslationPublish.php
index ae481a4..c0158cd 100644
--- a/api/ApiContentTranslationPublish.php
+++ b/api/ApiContentTranslationPublish.php
@@ -44,7 +44,7 @@
 
$status = $req->execute();
if ( !$status->isOK() ) {
-   throw new MWException( $req->getContent() );
+   throw new MWException( $status );
}
 
return $req->getContent();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2507840c32f853cf15100fe42f899675e2f149ed
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Log publishing errors to eventlogging for future analysis an... - change (mediawiki...ContentTranslation)

2015-04-08 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Log publishing errors to eventlogging for future analysis and 
fix
..

Log publishing errors to eventlogging for future analysis and fix

Uses Schema:ContentTranslationError
https://meta.wikimedia.org/wiki/Schema:ContentTranslationError

Change-Id: I0c6e8b99ac7e6e02a15bd1bdd57d2b321dcd49d2
---
M ContentTranslation.hooks.php
M modules/eventlogging/ext.cx.eventlogging.js
M modules/publish/ext.cx.publish.js
3 files changed, 16 insertions(+), 2 deletions(-)


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

diff --git a/ContentTranslation.hooks.php b/ContentTranslation.hooks.php
index 268239a..d2bb80d 100644
--- a/ContentTranslation.hooks.php
+++ b/ContentTranslation.hooks.php
@@ -112,6 +112,7 @@
public static function addEventLogging( array &$schemas ) {
$schemas['ContentTranslation'] = 11628043;
$schemas['ContentTranslationCTA'] = 11616099;
+   $schemas['ContentTranslationError'] = 11767097;
}
 
/**
diff --git a/modules/eventlogging/ext.cx.eventlogging.js 
b/modules/eventlogging/ext.cx.eventlogging.js
index c4c7e1b..09c7bf7 100644
--- a/modules/eventlogging/ext.cx.eventlogging.js
+++ b/modules/eventlogging/ext.cx.eventlogging.js
@@ -61,8 +61,9 @@
 * @param {string} targetLanguage Target language code
 * @param {string} sourceTitle Source title
 * @param {string} targetTitle Target title
+* @param {string} trace Error trace
 */
-   publishFailed: function ( sourceLanguage, targetLanguage, 
sourceTitle, targetTitle ) {
+   publishFailed: function ( sourceLanguage, targetLanguage, 
sourceTitle, targetTitle, trace ) {
mw.track( 'event.ContentTranslation', {
version: 1,
token: mw.user.id(),
@@ -73,6 +74,17 @@
sourceTitle: sourceTitle,
targetTitle: targetTitle
} );
+   mw.track( 'event.ContentTranslationError', {
+   version: 1,
+   token: mw.user.id(),
+   session: mw.user.sessionId(),
+   context: 'publish-failure',
+   sourceLanguage: sourceLanguage,
+   targetLanguage: targetLanguage,
+   sourceTitle: sourceTitle,
+   targetTitle: targetTitle,
+   trace: trace
+   } );
},
 
/**
diff --git a/modules/publish/ext.cx.publish.js 
b/modules/publish/ext.cx.publish.js
index 233ffa2..42e9508 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -283,7 +283,8 @@
mw.cx.sourceLanguage,
mw.cx.targetLanguage,
mw.cx.sourceTitle,
-   this.targetTitle
+   this.targetTitle,
+   JSON.stringify( details )
);
mw.hook( 'mw.cx.error' ).fire( mw.msg( 'cx-publish-page-error' 
) );
mw.log( '[CX] Error while publishing:', code, trace );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0c6e8b99ac7e6e02a15bd1bdd57d2b321dcd49d2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Use ParsoidVirtualRESTService for HTML to Wikitext transform... - change (mediawiki...ContentTranslation)

2015-04-09 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Use ParsoidVirtualRESTService for HTML to Wikitext 
transformation
..

Use ParsoidVirtualRESTService for HTML to Wikitext transformation

Change-Id: I4b0c4c078efc9fdc98863c22cb72945b67b72733
---
M api/ApiContentTranslationPublish.php
1 file changed, 46 insertions(+), 20 deletions(-)


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

diff --git a/api/ApiContentTranslationPublish.php 
b/api/ApiContentTranslationPublish.php
index c0158cd..b62b2d0 100644
--- a/api/ApiContentTranslationPublish.php
+++ b/api/ApiContentTranslationPublish.php
@@ -18,36 +18,62 @@
 class ApiContentTranslationPublish extends ApiBase {
 
/**
+* @var VirtualRESTServiceClient
+*/
+   protected $serviceClient;
+
+   public function __construct( ApiMain $main, $name ) {
+   global $wgContentTranslationParsoid;
+   parent::__construct( $main, $name );
+   $this->serviceClient = new VirtualRESTServiceClient( new 
MultiHttpClient( array() ) );
+   $parsoidConfig = $wgContentTranslationParsoid;
+   $this->serviceClient->mount( '/parsoid/', new 
ParsoidVirtualRESTService( array(
+   'URL' => $parsoidConfig['url'],
+   'prefix' => $parsoidConfig['prefix'],
+   'timeout' => $parsoidConfig['timeout'],
+   ) ) );
+   }
+
+   private function requestParsoid( $method, $path, $params ) {
+   $request = array(
+   'method' => $method,
+   'url' => '/parsoid/local/v1/' . $path
+   );
+   if ( $method === 'GET' ) {
+   $request['query'] = $params;
+   } else {
+   $request['body'] = $params;
+   }
+   $response = $this->serviceClient->run( $request );
+   if ( $response['code'] === 200 && $response['error'] === "" ) {
+   return $response['body'];
+   } elseif ( $response['error'] !== '' ) {
+   $this->dieUsage( 'parsoidserver-http-error: ' . 
$response['code'], $response['error'] );
+   } else { // error null, code not 200
+   $this->dieUsage( 'parsoidserver-http: HTTP ' . 
$response['code'], $response['error'] );
+   }
+   }
+
+   /**
 * Converts html to wikitext
 *
 * @param Title $title
 * @param string $html
-* @return Status
-* @throw MWException
+* @return string Wiki text
 */
protected function convertHtmlToWikitext( Title $title, $html ) {
-   global $wgContentTranslationParsoid;
-
-   $conf = $wgContentTranslationParsoid;
-   $page = urlencode( $title->getPrefixedDBkey() );
-
-   $req = MWHttpRequest::factory(
-   "{$conf['url']}/{$conf['prefix']}/$page",
+   $wikitext = $this->requestParsoid(
+   'POST',
+   'transform/html/to/wikitext/' . urlencode( 
$title->getPrefixedDBkey() ),
array(
-   'method' => 'POST',
-   'postData' => array(
-   'content' => $html,
-   ),
-   'timeout' => $conf['timeout'],
+   'html' => $html,
+   'oldid' => $parserParams['oldid'],
)
);
-
-   $status = $req->execute();
-   if ( !$status->isOK() ) {
-   throw new MWException( $status );
+   if ( $wikitext === false ) {
+   $this->dieUsage( 'Error contacting the Parsoid server', 
'parsoidserver' );
}
-
-   return $req->getContent();
+   return $wikitext;
}
 
protected function saveWikitext( $title, $wikitext, $params ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4b0c4c078efc9fdc98863c22cb72945b67b72733
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Update contributions menu to use latest callout widget - change (mediawiki...ContentTranslation)

2015-04-13 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Update contributions menu to use latest callout widget
..

Update contributions menu to use latest callout widget

Change-Id: I2da5e4b0afcd9079f328d2143cb4ad2afbc862a1
---
M modules/campaigns/ext.cx.campaigns.contributionsmenu.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/campaigns/ext.cx.campaigns.contributionsmenu.js 
b/modules/campaigns/ext.cx.campaigns.contributionsmenu.js
index 9489fa8..281c2ec 100644
--- a/modules/campaigns/ext.cx.campaigns.contributionsmenu.js
+++ b/modules/campaigns/ext.cx.campaigns.contributionsmenu.js
@@ -54,7 +54,7 @@
$trigger.callout( {
trigger: 'manual',
classes: 'cx-campaign-contributionsmenu',
-   gravity: $.fn.callout.autoNEW,
+   direction: $.fn.callout.autoDirection( '1' ),
content: $menu
} );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2da5e4b0afcd9079f328d2143cb4ad2afbc862a1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix a js error when publishing fails because of unknown reasons - change (mediawiki...ContentTranslation)

2015-04-13 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Fix a js error when publishing fails because of unknown reasons
..

Fix a js error when publishing fails because of unknown reasons

Change-Id: I2c635fa9b581a9bb3db11ebc2ca2dd986d34bdac
---
M modules/publish/ext.cx.publish.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/publish/ext.cx.publish.js 
b/modules/publish/ext.cx.publish.js
index 42e9508..dc76dd4 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -63,7 +63,7 @@
} );
}
// Any other failure
-   self.fail( 'cxpublish', '[CX] Unexpected error 
while publishing: ' + response.cxpublish );
+   self.onFail( 'cxpublish', '[CX] Unexpected 
error while publishing: ' + response.cxpublish );
} ).fail( function ( code, details ) {
self.onFail( code, details );
} ).always( function () {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2c635fa9b581a9bb3db11ebc2ca2dd986d34bdac
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Make sure references templates not getting removed from source - change (mediawiki...ContentTranslation)

2015-04-16 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Make sure references templates not getting removed from source
..

Make sure references templates not getting removed from source

Test translating Dong_Qichang from fr to some other language where we
do not have a template configuration

Bug: T96239
Change-Id: I0afd066c9449484aacdc07e1d21a740341db9706
---
M modules/source/ext.cx.source.filter.js
1 file changed, 21 insertions(+), 0 deletions(-)


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

diff --git a/modules/source/ext.cx.source.filter.js 
b/modules/source/ext.cx.source.filter.js
index fe5940c..d5661a0 100644
--- a/modules/source/ext.cx.source.filter.js
+++ b/modules/source/ext.cx.source.filter.js
@@ -41,6 +41,20 @@
}
 
/**
+* Check if the template is references
+* @param {jQuery} $template
+* @return {boolean} Whether the template is references or not.
+*/
+   function isReferences( $template ) {
+   if ( $template.is( '[typeof*="mw:Extension/references"]' ) ||
+   $template.find( '[typeof*="mw:Extension/references"]' 
).length ) {
+   return true;
+   }
+
+   return false;
+   }
+
+   /**
 * Simple check for inline templates.
 * @param {jQuery} $template
 * @return {boolean} Whether the template is inline or not.
@@ -122,6 +136,13 @@
 
if ( isInlineTemplate( $template ) ) {
mw.log( '[CX] Keeping inline template: ' + 
templateName );
+   return;
+   }
+   // Even if the template configuration has not 
whitelisted the references
+   // template, we must keep it to get the references in 
published article
+   // working. So try to identify references template and 
keep it.
+   if ( isReferences( $template ) ) {
+   mw.log( '[CX] Keeping references template: ' + 
templateName );
} else {
mw.log( '[CX] Removing template: ' + 
templateName );
sourceFilter.removeTemplate( $template );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0afd066c9449484aacdc07e1d21a740341db9706
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Avoid a js error in postMT handler of translations module - change (mediawiki...ContentTranslation)

2015-04-16 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Avoid a js error in postMT handler of translations module
..

Avoid a js error in postMT handler of translations module

Change-Id: I3c9a946419f06a71c33232cfce84041ac25f17e4
---
M modules/translation/ext.cx.translation.js
1 file changed, 9 insertions(+), 2 deletions(-)


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

diff --git a/modules/translation/ext.cx.translation.js 
b/modules/translation/ext.cx.translation.js
index 67d71a8..b76b0b3 100644
--- a/modules/translation/ext.cx.translation.js
+++ b/modules/translation/ext.cx.translation.js
@@ -166,9 +166,16 @@
 * @param {jQuery} $section
 */
ContentTranslationEditor.prototype.postProcessMT = function ( $section 
) {
-   var selection,
-   $sourceSection = mw.cx.getSourceSection( $section.data( 
'source' ) );
+   var selection, $sourceSection;
 
+   if ( !$section || !$section.length ) {
+   // Empty references in some articles cause this.
+   // Example: See Notes section in
+   // 
https://fr.wikipedia.org/w/index.php?title=Dong_Qichang&oldid=100845438
+   return;
+   }
+
+   $sourceSection = mw.cx.getSourceSection( $section.data( 
'source' ) );
mw.hook( 'mw.cx.translation.change' ).fire( $section );
mw.hook( 'mw.cx.translation.focus' ).fire( $section );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c9a946419f06a71c33232cfce84041ac25f17e4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Show login page if the URL has campaign parameter for anon u... - change (mediawiki...ContentTranslation)

2015-06-04 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Show login page if the URL has campaign parameter for anon users
..

Show login page if the URL has campaign parameter for anon users

For non-logged-in users show login page instead of nosuchspecialpage
if the URL has campaign parameter.
After login the user should be taken to Special:CX again with all query 
parameters.

This is important for campaigns like email campaigns.
When user click the user may not be logged in.
Showing nosuchspecialpage is a bad idea in that case.

Bug: T101489
Change-Id: I600af89c91e14e45e58dcb17fa98d3cdda09122b
---
M specials/SpecialContentTranslation.php
1 file changed, 8 insertions(+), 0 deletions(-)


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

diff --git a/specials/SpecialContentTranslation.php 
b/specials/SpecialContentTranslation.php
index b818d05..1fdb2a5 100644
--- a/specials/SpecialContentTranslation.php
+++ b/specials/SpecialContentTranslation.php
@@ -87,6 +87,14 @@
// User has a token. Enabled cx for the user in 
this wiki.
$this->enableCXBetaFeature();
} else {
+   if ( $campaign ) {
+   // Show login page if the URL has 
campaign parameter
+   $out->showPermissionsErrorPage(
+   array( array( 
'badaccess-groups' ) ),
+   'edit'
+   );
+   return;
+   }
$out->showErrorPage( 'nosuchspecialpage', 
'nospecialpagetext' );
return;
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I600af89c91e14e45e58dcb17fa98d3cdda09122b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Avoid cx-segment spans appearing in published content - change (mediawiki...ContentTranslation)

2015-06-05 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Avoid cx-segment spans appearing in published content
..

Avoid cx-segment spans appearing in published content

Testplan:

Start translating a paragraph. After the source content
copied to target paragraph, delete the last sentence of
that paragraph using backspace.
Inspect the paragraph and we will see that even though the
content was removed, the wrapper span still exist as empty
span in the paragraph. Now publish. Without this patch,
the published content will have that empty span. With this
patch you should not see the empty span in the published
content.

For unknown reason to me, the replaceWith function with
the cloned content does not remove all .cx-segment spans.
With the above testplan, the empty span.cx-segment did not
get removed. So I am reducing the scope of .find and
.replaceWith to section levels and I see it working.

Bug: T96234
Change-Id: I962c6ae8e6993e597c71a8c283868554fdb546d1
---
M modules/publish/ext.cx.publish.js
1 file changed, 4 insertions(+), 6 deletions(-)


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

diff --git a/modules/publish/ext.cx.publish.js 
b/modules/publish/ext.cx.publish.js
index b05e9dd..362a658 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -314,11 +314,6 @@
 * @return {string} processed html
 */
CXPublish.prototype.prepareTranslationForPublish = function ( $content 
) {
-   // Remove the wrapper tags that are added to the highlighting 
segments
-   $content.find( '.cx-segment' ).replaceWith( function () {
-   return $( this ).html();
-   } );
-
// Remove unnecessary elements
$content.find( 'link, title, .placeholder' ).remove();
 
@@ -333,7 +328,10 @@
if ( $section.is( 'h1, h2, h3, h4, h5, h6' ) ) {
$section.find( 'br' ).remove();
}
-
+   // Remove the wrapper tags that are added to the 
highlighting segments
+   $section.find( '.cx-segment' ).replaceWith( function () 
{
+   return $( this ).html();
+   } );
// Remove empty sections
if ( !$.trim( $section.text() ) ) {
$section.remove();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I962c6ae8e6993e597c71a8c283868554fdb546d1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix JSCS errors - change (mediawiki...ContentTranslation)

2015-06-07 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Fix JSCS errors
..

Fix JSCS errors

Change-Id: I90a0447331df082b4aaff05540ae2ead6678ecad
---
M modules/stats/ext.cx.stats.js
M modules/tools/ext.cx.tools.reference.js
M modules/widgets/callout/ext.cx.callout.js
3 files changed, 31 insertions(+), 31 deletions(-)


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

diff --git a/modules/stats/ext.cx.stats.js b/modules/stats/ext.cx.stats.js
index 8a8ddcd..6ef6b2e 100644
--- a/modules/stats/ext.cx.stats.js
+++ b/modules/stats/ext.cx.stats.js
@@ -166,7 +166,7 @@
{
title: mw.msg( 
'cx-stats-draft-target-source' ),
content: this.drawTranslationsChart( 
'to', 'draft', 'count' )
-   },
+   },
{
title: mw.msg( 
'cx-stats-draft-source-target' ),
content: this.drawTranslationsChart( 
'from', 'draft', 'count' )
@@ -386,7 +386,7 @@
data: $.map( 
this.totalTranslationTrend, function ( data ) {
return data.count;
} )
-   },
+   },
{
label: mw.message(
'cx-trend-translations-to',
@@ -397,8 +397,8 @@
data: $.map( 
this.languageTranslatonTrend, function ( data ) {
return data.count;
} )
-   }
-   ]
+   }
+   ]
};
 
/*global Chart:false */
@@ -430,7 +430,6 @@
this.sourceTargetModel[ status ][ sourceLanguage 
].push( record );
this.targetSourceModel[ status ][ targetLanguage 
].push( record );
}
-
 
for ( status in this.sourceTargetModel ) {
tempModel = this.sourceTargetModel[ status ];
diff --git a/modules/tools/ext.cx.tools.reference.js 
b/modules/tools/ext.cx.tools.reference.js
index f31b21f..6411f99 100644
--- a/modules/tools/ext.cx.tools.reference.js
+++ b/modules/tools/ext.cx.tools.reference.js
@@ -93,7 +93,7 @@
referenceId = $reference.prop( 'id' );
targetReferenceId = 'cx' + referenceId;
$reference.attr( {
-   'id': targetReferenceId,
+   id: targetReferenceId,
'data-sourceid': referenceId
} );
mw.cx.selection.pasteHTML( $reference[ 0 ].outerHTML );
diff --git a/modules/widgets/callout/ext.cx.callout.js 
b/modules/widgets/callout/ext.cx.callout.js
index 757747c..9508dd0 100644
--- a/modules/widgets/callout/ext.cx.callout.js
+++ b/modules/widgets/callout/ext.cx.callout.js
@@ -293,38 +293,39 @@
$this = $( this );
 
leftFlips = {
-   '1': '11',
-   '2': '10',
-   '3': '9',
-   '4': '8',
-   '5': '7'
+   1: '11',
+   2: '10',
+   3: '9',
+   4: '8',
+   5: '7'
};
rightFlips = {
-   '11': '1',
-   '10': '2',
-   '9': '3',
-   '8': '4',
-   '7': '5'
+   11: '1',
+   10: '2',
+   9: '3',
+   8: '4',
+   7: '5'
};
topFlips = {
-   '3': '2',
-   '4': '2',
-   '5': '1',
-   '6': '0',
-   '7': '11',
-   '8': '10',
-   '9': '10'
+   3: '2',
+   4: '2',
+   5: '1',
+   6: '0',
+   7: '11',
+

[MediaWiki-commits] [Gerrit] Callout widget: Improve the hover behavior - change (mediawiki...ContentTranslation)

2015-06-07 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Callout widget: Improve the hover behavior
..

Callout widget: Improve the hover behavior

Avoid showing multiple callouts if the trigger is 'hover'.
Also hide the callout, if mouse entered in siblings of triggers,
if present.

For contribution menu, this improves a user experience. Now moving
mouse over contribution list to logout link, horizontally does not
cause the contribution menu hide. With this patch it will hide.

For stats page, we can improve the custom hover handler because
the widget will make sure only one callout is shown. While fixing
that, fixed a small bug that the menu is coming only when tail for
bars(bar with ...) is present.

Change-Id: Iadadf68023eaa7aa8506e9076d80847eef64296c
---
M modules/campaigns/ext.cx.campaigns.contributionsmenu.js
M modules/stats/ext.cx.stats.js
M modules/widgets/callout/ext.cx.callout.js
3 files changed, 12 insertions(+), 12 deletions(-)


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

diff --git a/modules/campaigns/ext.cx.campaigns.contributionsmenu.js 
b/modules/campaigns/ext.cx.campaigns.contributionsmenu.js
index 33ef2fe..d58a4a6 100644
--- a/modules/campaigns/ext.cx.campaigns.contributionsmenu.js
+++ b/modules/campaigns/ext.cx.campaigns.contributionsmenu.js
@@ -65,7 +65,7 @@
$myContributions, $myTranslations, $myUploads,
$menu, callout;
 
-   $trigger = $( '#pt-mycontris a' );
+   $trigger = $( '#pt-mycontris' );
 
$myContributions = $( '' )
.addClass( 'cx-campaign-contributions' )
diff --git a/modules/stats/ext.cx.stats.js b/modules/stats/ext.cx.stats.js
index 6ef6b2e..553b533 100644
--- a/modules/stats/ext.cx.stats.js
+++ b/modules/stats/ext.cx.stats.js
@@ -310,19 +310,15 @@
.text( '…' )
.css( 'width', tailWidth + '%' );
$translations.append( $tail );
-   /*jslint loopfunc: true */
-   $tail.callout( {
-   trigger: 'manual',
-   direction: 
$.fn.callout.autoDirection( '0' ),
-   content: $callout
-   } ).on( 'mouseenter', function () {
-   $( this ).callout( 'show' );
-   } )
-   .on( 'mouseleave', function () {
-   $( this ).callout( 'hide' );
-   } );
}
 
+   /*jslint loopfunc: true */
+   $translations.find( '.cx-stats-chart__bar' 
).last().callout( {
+   trigger: 'hover',
+   direction: $.fn.callout.autoDirection( '0' ),
+   content: $callout
+   } );
+
$row.append(
$( '' )
.addClass( 'cx-stats-chart__langcode' )
diff --git a/modules/widgets/callout/ext.cx.callout.js 
b/modules/widgets/callout/ext.cx.callout.js
index 9508dd0..1469abd 100644
--- a/modules/widgets/callout/ext.cx.callout.js
+++ b/modules/widgets/callout/ext.cx.callout.js
@@ -209,7 +209,11 @@
 
if ( this.options.trigger === 'hover' ) {
this.$element.on( 'mouseenter', function () {
+   // Hide all other cx-callouts
+   $( '.cx-callout' ).hide();
self.show();
+   // On mouse enter of siblings, hide.
+   self.$element.siblings().one( 'mouseenter', 
$.proxy( self.hide, self ) );
self.$dialog.one( 'mouseleave', $.proxy( 
self.hide, self ) );
$( document ).one( 'click', $.proxy( self.hide, 
self ) );
} );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iadadf68023eaa7aa8506e9076d80847eef64296c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Published translations API: Correct the condition - change (mediawiki...ContentTranslation)

2015-06-08 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Published translations API: Correct the condition
..

Published translations API: Correct the condition

The api was using translation status as the only condition.
This will exclude translations once published and now in draft.

Used the same condition used for identifying published translation.

Change-Id: I86c4fede42acc1550044d7d91a4c0cbc42ad6bf4
---
M includes/Translation.php
1 file changed, 7 insertions(+), 1 deletion(-)


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

diff --git a/includes/Translation.php b/includes/Translation.php
index c7ba517..ff2486e 100644
--- a/includes/Translation.php
+++ b/includes/Translation.php
@@ -322,7 +322,13 @@
 */
public static function getAllPublishedTranslations( $from, $to, $limit, 
$offset ) {
$dbr = Database::getConnection( DB_SLAVE );
-   $conditions = array( 'translation_status' => 'published' );
+   $conditions = array( $dbr->makeList(
+   array(
+   'translation_status' => 'published',
+   'translation_target_url IS NOT NULL',
+   ),
+   LIST_OR
+   ) );
 
if ( $from ) {
$conditions['translation_source_language'] = $from;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I86c4fede42acc1550044d7d91a4c0cbc42ad6bf4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix js error in the CX contribution menu when VE is triggered - change (mediawiki...ContentTranslation)

2015-06-08 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Fix js error in the CX contribution menu when VE is triggered
..

Fix js error in the CX contribution menu when VE is triggered

The $dialog of callout instance of trigger is null till callout
is shown. If the callout was not shown before VE trigger, accessing
$dialog can create js error.

Bug: T101421
Change-Id: I2ae3dc93ba76d9ca816d64d811a00cacd193373c
---
M modules/campaigns/ext.cx.campaigns.contributionsmenu.js
1 file changed, 10 insertions(+), 13 deletions(-)


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

diff --git a/modules/campaigns/ext.cx.campaigns.contributionsmenu.js 
b/modules/campaigns/ext.cx.campaigns.contributionsmenu.js
index 33ef2fe..c4c889b 100644
--- a/modules/campaigns/ext.cx.campaigns.contributionsmenu.js
+++ b/modules/campaigns/ext.cx.campaigns.contributionsmenu.js
@@ -60,12 +60,9 @@
return $item;
}
 
-   function showInvitation() {
-   var $trigger,
-   $myContributions, $myTranslations, $myUploads,
+   function attachMenu( $trigger ) {
+   var $myContributions, $myTranslations, $myUploads,
$menu, callout;
-
-   $trigger = $( '#pt-mycontris a' );
 
$myContributions = $( '' )
.addClass( 'cx-campaign-contributions' )
@@ -110,18 +107,18 @@
}
 
$( function () {
-   var blacklist = mw.config.get( 
'wgContentTranslationBrowserBlacklist' );
+   var $trigger, blacklist = mw.config.get( 
'wgContentTranslationBrowserBlacklist' );
 
if ( !$.client.test( blacklist, null, true ) ) {
-   showInvitation();
+   $trigger = $( '#pt-mycontris' );
 
-   // Show it after creating a new article using VE
+   attachMenu( $trigger );
+
+   // Change the menu when creating a new article using VE
mw.hook( 've.activationComplete' ).add( function () {
-   var $trigger;
-
-   $trigger = $( '#pt-mycontris a' );
-   $trigger.data( 'callout' ).$dialog.find( 
'li.cx-campaign-translations' )
-   .replaceWith( getTranslationsItem() );
+   // Rebuild menu.
+   $trigger.removeData( 'callout' );
+   attachMenu( $trigger );
} );
}
} );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2ae3dc93ba76d9ca816d64d811a00cacd193373c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Support gallery translations - change (mediawiki...ContentTranslation)

2015-06-08 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Support gallery translations
..

Support gallery translations

Adapt the galleries in source article to target article.
Copy the images and translate(if MT present). Editing gallery text
won't be allowed at present.

Testplan:
Translate Radimlja article from English to Spanish.
Special:ContentTranslation&page=Radimlja&from=en&to=es&targettitle=Radimlja
Just click on the gallery in the page. You should see gallery copied to 
translation
and the gallery captions translated using Apertium.
Publish the article and you should see the following wikitext in the published 
page.

== Galería ==

File:Radmilja 1.jpg|Radimlja
File:Radmilja 2.jpg|Señal en la entrada a Radimlja
File:Radmilja 3.jpg|Radimlja, stecak necrópolis


Bug: T96159
Change-Id: I5f1768c336a46a5534af1f90688d530b97f04e00
---
M Resources.php
A modules/tools/ext.cx.tools.gallery.js
2 files changed, 59 insertions(+), 0 deletions(-)


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

diff --git a/Resources.php b/Resources.php
index 4aa09dd..51b4f71 100644
--- a/Resources.php
+++ b/Resources.php
@@ -296,6 +296,7 @@
'ext.cx.progressbar',
'ext.cx.tools.dictionary',
'ext.cx.tools.formatter',
+   'ext.cx.tools.gallery',
'ext.cx.tools.images',
'ext.cx.tools.instructions',
'ext.cx.tools.link',
@@ -470,6 +471,12 @@
),
 ) + $resourcePaths;
 
+$wgResourceModules['ext.cx.tools.gallery'] = array(
+   'scripts' => array(
+   'tools/ext.cx.tools.gallery.js',
+   ),
+) + $resourcePaths;
+
 $wgResourceModules['ext.cx.tools.categories'] = array(
'scripts' => array(
'tools/ext.cx.tools.categories.js',
diff --git a/modules/tools/ext.cx.tools.gallery.js 
b/modules/tools/ext.cx.tools.gallery.js
new file mode 100644
index 000..a5699e1
--- /dev/null
+++ b/modules/tools/ext.cx.tools.gallery.js
@@ -0,0 +1,52 @@
+/**
+ * ContentTranslation Tools
+ * A tool that allows editors to translate pages from one language
+ * to another with the help of machine translation and other translation tools
+ *
+ * @file
+ * @ingroup Extensions
+ * @copyright See AUTHORS.txt
+ * @license GPL-2.0+
+ */
+( function ( $, mw ) {
+   'use strict';
+
+   function adaptGallery( $section ) {
+   var i, $sourceSection, galleryData, galleryWikiMarkup = '',
+   imageItems, caption, imageIndex = 0;
+
+   if ( !$section.is( '[typeof*="mw:Extension/gallery"]' ) ) {
+   return;
+   }
+   $sourceSection = mw.cx.getSourceSection( $section.data( 
'source' ) );
+   galleryData = $sourceSection.data( 'mw' );
+   // Copy the translated gallery image captions to the data-mw
+   // so that parsoid can create the  tag with image 
items.
+   galleryWikiMarkup = galleryData.body.extsrc;
+   imageItems = galleryWikiMarkup.split( '\n' );
+   for ( i = 0; i < imageItems.length; i++ ) {
+   if ( imageItems[ i ].trim() ) {
+   // FIXME: Copying plain text of gallery text 
will definitely lose the html
+   // mark up in translation. What we need is 
Wikitext of the translated HTML.
+   // That require a restbase api call.
+   caption = $section.find( '.gallerytext' ).eq( 
imageIndex ).text().trim();
+   imageItems[ i ] = [ imageItems[ i ].split( '|' 
)[ 0 ], caption ].join( '|' );
+   imageIndex++;
+   }
+   }
+
+   galleryData.body.extsrc = imageItems.join( '\n' );
+   // Copy the data-mw to target section.
+   $section.attr( 'data-mw', JSON.stringify( galleryData ) );
+   // Ultimately, this should make parsoid generate the following 
Wikitext in published page
+   // 
+   // File:Radmilja 1.jpg|Radimlja
+   // File:Radmilja 2.jpg|Señal en la entrada a Radimlja
+   // File:Radmilja 3.jpg|Radimlja, stecak necrópolis
+   // 
+   }
+
+   $( function () {
+   mw.hook( 'mw.cx.translation.postMT' ).add( adaptGallery );
+   } );
+}( jQuery, mediaWiki ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5f1768c336a46a5534af1f90688d530b97f04e00
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
M

[MediaWiki-commits] [Gerrit] Fix JS error while accessing Special:CXStats as anon user - change (mediawiki...ContentTranslation)

2015-06-09 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Fix JS error while accessing Special:CXStats as anon user
..

Fix JS error while accessing Special:CXStats as anon user

Added missing RL module.

Bug: T101813
Change-Id: I847c0dca9a1594a02e8c7e9f22a947dae855eb62
---
M Resources.php
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/Resources.php b/Resources.php
index 4aa09dd..9a67a42 100644
--- a/Resources.php
+++ b/Resources.php
@@ -704,6 +704,7 @@
'chart.js',
'jquery.uls.data',
'ext.cx.widgets.spinner',
+   'ext.cx.widgets.callout',
),
'messages' => array(
'cx-stats-table-source-target',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I847c0dca9a1594a02e8c7e9f22a947dae855eb62
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Avoid bars overlapping or breaking the row - change (mediawiki...ContentTranslation)

2015-06-09 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Avoid bars overlapping or breaking the row
..

Avoid bars overlapping or breaking the row

Bug: T101815
Change-Id: I5dd44aa2d1c6486e896cb353e49c41e296449152
---
M modules/stats/styles/ext.cx.stats.less
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/modules/stats/styles/ext.cx.stats.less 
b/modules/stats/styles/ext.cx.stats.less
index 95813c1..1275b1e 100644
--- a/modules/stats/styles/ext.cx.stats.less
+++ b/modules/stats/styles/ext.cx.stats.less
@@ -115,6 +115,7 @@
height: 20px;
padding: 0;
margin: 0;
+   box-sizing: border-box;
background-color: #347bff;
border-right: 1px solid @gray;
font-size: small;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5dd44aa2d1c6486e896cb353e49c41e296449152
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Special:CXStats: Add link to tagfilter page in targetwikis. - change (mediawiki...ContentTranslation)

2015-06-09 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Special:CXStats: Add link to tagfilter page in targetwikis.
..

Special:CXStats: Add link to tagfilter page in targetwikis.

The total translation count is a link to
lang.wikipedia.org/wiki/Special:RecentChanges?tagfilter=contenttranslation

Change-Id: Iff8084e39f04ffa12c92ebee6d0c23359aae4aad
---
M modules/stats/ext.cx.stats.js
1 file changed, 18 insertions(+), 3 deletions(-)


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

diff --git a/modules/stats/ext.cx.stats.js b/modules/stats/ext.cx.stats.js
index f06d75a..e524fd0 100644
--- a/modules/stats/ext.cx.stats.js
+++ b/modules/stats/ext.cx.stats.js
@@ -237,6 +237,7 @@
CXStats.prototype.drawTranslationsChart = function ( direction, status, 
property ) {
var $chart, $bar, translations, $translations, model, i, j, 
$rows = [],
$callout,
+   $total,
$row, width, max = 0,
$tail, tailWidth = 0,
tail,
@@ -318,6 +319,22 @@
content: $callout
} );
 
+   $total = $( '' )
+   .addClass( 'cx-stats-chart__total' )
+   .text( fmt( model[ i ][ property ] ) );
+
+   if ( direction === 'to' ) {
+   $total = $( '' )
+   .addClass( 'cx-stats-chart__total' )
+   .attr( 'href', 
mw.cx.siteMapper.getPageUrl(
+   model[ i ].language, 
'Special:RecentChanges', { tagfilter: 'contenttranslation' }
+   ) )
+   .text( fmt( model[ i ][ property ] ) );
+   } else {
+   $total = $( '' )
+   .addClass( 'cx-stats-chart__total' )
+   .text( fmt( model[ i ][ property ] ) );
+   }
$row.append(
$( '' )
.addClass( 'cx-stats-chart__langcode' )
@@ -325,9 +342,7 @@
$( '' )
.addClass( 'cx-stats-chart__autonym' )
.text( $.uls.data.getAutonym( model[ i 
].language ) ),
-   $( '' )
-   .addClass( 'cx-stats-chart__total' )
-   .text( fmt( model[ i ][ property ] ) ),
+   $total,
$translations
);
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iff8084e39f04ffa12c92ebee6d0c23359aae4aad
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Bind link handlers to source links even if target section is... - change (mediawiki...ContentTranslation)

2015-06-09 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Bind link handlers to source links even if target section is 
empty
..

Bind link handlers to source links even if target section is empty

If target section has not links, llink handlers were not added to
links in source section. This is problematic.

Make sure all source and target links are with link handlers.

Change-Id: I052e22c04f93c0ca9ab9824ae12641d8f43d0b1f
---
M modules/tools/ext.cx.tools.link.js
1 file changed, 7 insertions(+), 1 deletion(-)


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

diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index 79485bc..b44c0a3 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -280,7 +280,7 @@
selection = mw.cx.selection.get();
$link = $( '' )
.addClass( 'cx-target-link' )
-   .text( selection.toString() )
+   .text( selection.toString() || this.title )
.attr( {
title: this.title,
href: this.title,
@@ -870,8 +870,10 @@
 */
function adaptLinks( $section ) {
var $links,
+   $sourceSection,
sourceLinkTargets = [];
 
+   $sourceSection = mw.cx.getSourceSection( $section.data( 
'source' ) );
$links = $section.find( 'a[rel="mw:WikiLink"]' );
 
if ( !$section.data( 'cx-draft' ) ) {
@@ -885,6 +887,10 @@
.done( function () {
$links.cxTargetLink();
} );
+   $sourceSection.find( 'a[rel="mw:WikiLink"]' ).each( function () 
{
+   $( this ).cxSourceLink();
+   } );
+
}
 
mw.cx.tools.link = LinkCard;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I052e22c04f93c0ca9ab9824ae12641d8f43d0b1f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix: Link adapation does not happen when language code and d... - change (mediawiki...ContentTranslation)

2015-06-10 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Fix: Link adapation does not happen when language code and 
domain differs
..

Fix: Link adapation does not happen when language code and domain differs

Testplan:
Translate:
Special:ContentTranslation&page=LaTeX&from=simple&to=bho
Without this patch, user will see all links in translation
template as missing. With this patch, links will be adapated
to bh.

Bug: T99888
Change-Id: I2d5021c27f8b03563ef5a16723bed3ea83d0e701
---
M modules/base/ext.cx.sitemapper.js
M modules/tools/ext.cx.tools.link.js
2 files changed, 31 insertions(+), 21 deletions(-)


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

diff --git a/modules/base/ext.cx.sitemapper.js 
b/modules/base/ext.cx.sitemapper.js
index 6d7aa72..aec45af 100644
--- a/modules/base/ext.cx.sitemapper.js
+++ b/modules/base/ext.cx.sitemapper.js
@@ -11,21 +11,6 @@
 ( function ( $, mw ) {
'use strict';
 
-   // Some wikis have domain names that do not match the content language.
-   // See: wgLanguageCode in 
operations/mediawiki-config/wmf-config/InitialiseSettings.php
-   // NOTE: Keep list of mapping in sync with includes/SiteMapper.php
-   var languageToWikiDomainMapping = {
-   bho: 'bh',
-   'crh-latn': 'crh',
-   gsw: 'als',
-   sgs: 'bat-smg',
-   'be-tarask': 'be-x-old',
-   vro: 'fiu-vro',
-   rup: 'roa-rup',
-   lzh: 'zh-classical',
-   nan: 'zh-min-nan',
-   yue: 'zh-yue'
-   };
 
/**
 * Handles providing urls to different wikis.
@@ -35,6 +20,30 @@
this.config = siteconfig;
};
 
+
+   /**
+* Some wikis have domain names that do not match the content language.
+* See: wgLanguageCode in 
operations/mediawiki-config/wmf-config/InitialiseSettings.php
+* NOTE: Keep list of mapping in sync with includes/SiteMapper.php
+* @param {string} language Language code
+*/
+   mw.cx.SiteMapper.prototype.getWikiDomainCode = function ( language ) {
+   var languageToWikiDomainMapping = {
+   bho: 'bh',
+   'crh-latn': 'crh',
+   gsw: 'als',
+   sgs: 'bat-smg',
+   'be-tarask': 'be-x-old',
+   vro: 'fiu-vro',
+   rup: 'roa-rup',
+   lzh: 'zh-classical',
+   nan: 'zh-min-nan',
+   yue: 'zh-yue'
+   };
+
+   return languageToWikiDomainMapping[ language ] || language;
+   };
+
/**
 * Get the API for a remote wiki.
 *
@@ -42,10 +51,10 @@
 * @return {mediawiki.Api}
 */
mw.cx.SiteMapper.prototype.getApi = function ( language ) {
-   var url;
+   var url, domain;
 
-   language = languageToWikiDomainMapping[ language ] || language;
-   url = this.config.api.replace( '$1', language );
+   domain = this.getWikiDomainCode( language );
+   url = this.config.api.replace( '$1', domain );
return new mw.Api( {
ajax: {
url: url
@@ -63,15 +72,16 @@
 */
mw.cx.SiteMapper.prototype.getPageUrl = function ( language, title, 
params ) {
var base = this.config.view,
+   domain,
extra = '';
 
-   language = languageToWikiDomainMapping[ language ] || language;
+   domain = this.getWikiDomainCode( language );
if ( params && !$.isEmptyObject( params ) ) {
base = this.config.action || this.config.view;
extra = ( base.indexOf( '?' ) !== -1 ? '&' : '?' ) + 
$.param( params );
}
 
-   return base.replace( '$1', language ).replace( '$2', title ) + 
extra;
+   return base.replace( '$1', domain ).replace( '$2', title ) + 
extra;
};
 
/**
diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index db689a3..3d6c90a 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -77,7 +77,7 @@
titles: titles.join( '|' ),
prop: 'langlinks',
lllimit: titles.length, // TODO: Default is 10 and max 
is 500. Do we need more than 500?
-   lllang: language,
+   lllang: mw.cx.siteMapper.getWikiDomainCode( language ),
redirects: true,
format: 'json'
}, {

-- 
To view, visit https://gerr

[MediaWiki-commits] [Gerrit] Fix: References are adapted with same content - change (mediawiki...ContentTranslation)

2015-09-02 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Fix: References are adapted with same content
..

Fix: References are adapted with same content

This was a regression from If9ab5a98ae49b379c01f57a38f0b08c4e3fad122
which started processing internal templates inside templates. Wrong
usuage of array.push caused the Bug T110007

Testplan:

Translate article Factorio from en to fr and publish - All references
must be adapted properly. Content should not be repeated for references.
And for If9ab5a98ae49b379c01f57a38f0b08c4e3fad122, translate
Amblydoras from en to es. Start adding sections from top
to bottom. You will see references section added. Try publishing it.
Publishing will pass. This is normal case. Now translate the same
again and start clicking sections from bottom to top. That means,
you are adding references list first and then section containing reference
later. Try publishing. You will get parsoid error. With this patch,
adding sections in any order will not result publishing error.

Bug: T110007
Change-Id: I044193de3e2815e084489a48817340138fd639e7
---
M modules/tools/ext.cx.tools.template.js
1 file changed, 8 insertions(+), 7 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.template.js 
b/modules/tools/ext.cx.tools.template.js
index 5833b21..4cda0b4 100644
--- a/modules/tools/ext.cx.tools.template.js
+++ b/modules/tools/ext.cx.tools.template.js
@@ -209,18 +209,19 @@
 * @param {jQuery} $section Content translation section
 */
function processTemplates( $section ) {
-   var templates = [];
+   var i, template, templates = [];
 
if ( $section.is( '[typeof*="mw:Transclusion"]' ) ) {
templates.push( $section );
}
-   templates.push( $section.find( '[typeof*="mw:Transclusion"]' ) 
);
-
-   $.each( templates, function () {
-   var template = new TemplateTool( this );
-
+   templates = templates.concat(
+   // Convert the internal templates to a js array
+   $.makeArray( $section.find( 
'[typeof*="mw:Transclusion"]' ) )
+   );
+   for ( i = 0; i < templates.length; i++ ) {
+   template = new TemplateTool( templates[ i ] );
template.process();
-   } );
+   }
}
 
if ( typeof QUnit !== undefined ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I044193de3e2815e084489a48817340138fd639e7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Use the VirtualRESTService to configure CX - change (mediawiki...ContentTranslation)

2015-09-04 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Use the VirtualRESTService to configure CX
..

Use the VirtualRESTService to configure CX

This allows CX to use either Parsoid or RESTBase via the VRS, and
to share its configuration with Visual Editor.

Bug: T111490
Change-Id: I33bc150fa302d9523df92e9e8a258a19b63847f5
---
M api/ApiContentTranslationPublish.php
M extension.json
2 files changed, 53 insertions(+), 8 deletions(-)


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

diff --git a/api/ApiContentTranslationPublish.php 
b/api/ApiContentTranslationPublish.php
index 7728ebb..f5366fb 100755
--- a/api/ApiContentTranslationPublish.php
+++ b/api/ApiContentTranslationPublish.php
@@ -24,15 +24,59 @@
protected $serviceClient;
 
public function __construct( ApiMain $main, $name ) {
-   global $wgContentTranslationParsoid;
parent::__construct( $main, $name );
$this->serviceClient = new VirtualRESTServiceClient( new 
MultiHttpClient( array() ) );
-   $parsoidConfig = $wgContentTranslationParsoid;
-   $this->serviceClient->mount( '/parsoid/', new 
ParsoidVirtualRESTService( array(
-   'URL' => $parsoidConfig['url'],
-   'prefix' => $parsoidConfig['prefix'],
-   'timeout' => $parsoidConfig['timeout'],
-   ) ) );
+   $this->serviceClient->mount( '/parsoid/', $this->getVRSObject() 
);
+   }
+
+   /**
+* Creates the virtual REST service object to be used in CX's API 
calls. The
+* method determines whether to instantiate a ParsoidVirtualRESTService 
or a
+* RestbaseVirtualRESTService object based on configuration directives: 
if
+* $wgVirtualRestConfig['modules']['restbase'] is defined, RESTBase is 
chosen,
+* otherwise Parsoid is used (either by using the MW Core config, or the
+* VE-local one).
+*
+* @return VirtualRESTService the VirtualRESTService object to use
+*/
+   private function getVRSObject() {
+   // the params array to create the service object with
+   $params = array();
+   // the VRS class to use, defaults to Parsoid
+   $class = 'ParsoidVirtualRESTService';
+   $config = $this->getConfig();
+   // the global virtual rest service config object, if any
+   $vrs = $this->getConfig()->get( 'VirtualRestConfig' );
+   if ( isset( $vrs['modules'] ) && isset( 
$vrs['modules']['restbase'] ) ) {
+   // if restbase is available, use it
+   $params = $vrs['modules']['restbase'];
+   $class = 'RestbaseVirtualRESTService';
+   // remove once VE generates restbase paths
+   $params['parsoidCompat'] = true;
+   } elseif ( isset( $vrs['modules'] ) && isset( 
$vrs['modules']['parsoid'] ) ) {
+   // there's a global parsoid config, use it next
+   $params = $vrs['modules']['parsoid'];
+   } else {
+   // no global modules defined, fall back to old defaults
+   $params = array(
+   'URL' => $config->get( 
'ContentTranslationParsoid' )['url'],
+   'prefix' => $config->get( 
'ContentTranslationParsoid' )['prefix'],
+   'domain' => $config->get( 
'ContentTranslationParsoid' )['domain'],
+   'timeout' => $config->get( 
'ContentTranslationParsoid' )['timeout'],
+   );
+   }
+   // merge the global and service-specific params
+   if ( isset( $vrs['global'] ) ) {
+   $params = array_merge( $vrs['global'], $params );
+   }
+   // set up cookie forwarding
+   if ( $params['forwardCookies'] && !User::isEveryoneAllowed( 
'read' ) ) {
+   $params['forwardCookies'] = 
RequestContext::getMain()->getRequest()->getHeader( 'Cookie' );
+   } else {
+   $params['forwardCookies'] = false;
+   }
+   // create the VRS object and return it
+   return new $class( $params );
}
 
private function requestParsoid( $method, $path, $params ) {
diff --git a/extension.json b/extension.json
index b8910ae..a8e1a8e 100644
--- a/extension.json
+++ b/extension.json
@@ -101,7 +101,8 @@
"ContentTranslationParsoid": {
"url": "http://parsoid-lb.eqiad.wikimedia.org/";,
"timeout": 10,
-   "prefix": "enwiki"
+

[MediaWiki-commits] [Gerrit] Stats: Separate total and language graph, and show draft cou... - change (mediawiki...ContentTranslation)

2015-09-07 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Stats: Separate total and language graph, and show draft count 
in graph
..

Stats: Separate total and language graph, and show draft count in graph

This is in preparation for showing deletion stats and weekly trend
graphs.

Showing both total and language specific stats is difficult to
understand because the difference is widening fast. So separated them.

ApiQueryContentTranslationLanguageTrend now return cumulative count
for translations in progress as well. Soon it should retun
cumulative deleted stats too.

Bug: T105192
Bug: T90538
Change-Id: Ifd4bd0e3a92ac022428edf3915552ea99142dbfb
---
M api/ApiQueryContentTranslationLanguageTrend.php
M includes/Translation.php
M modules/stats/ext.cx.stats.js
M modules/stats/styles/ext.cx.stats.less
4 files changed, 196 insertions(+), 47 deletions(-)


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

diff --git a/api/ApiQueryContentTranslationLanguageTrend.php 
b/api/ApiQueryContentTranslationLanguageTrend.php
index cd5bf33..e8b9e43 100644
--- a/api/ApiQueryContentTranslationLanguageTrend.php
+++ b/api/ApiQueryContentTranslationLanguageTrend.php
@@ -32,7 +32,10 @@
$result->addValue(
array( 'query' ),
'contenttranslationlangtrend',
-   ContentTranslation\Translation::getTrend( $source, 
$target, $interval )
+   array(
+   'translations' => 
ContentTranslation\Translation::getPublishTrend( $source, $target, $interval ),
+   'drafts' => 
ContentTranslation\Translation::getDraftTrend( $source, $target, $interval )
+   )
);
}
 
diff --git a/includes/Translation.php b/includes/Translation.php
index c0a7c98..59c4a2d 100644
--- a/includes/Translation.php
+++ b/includes/Translation.php
@@ -211,10 +211,90 @@
}
 
/**
+* Get time-wise cumulative number of drafts for given
+* language pairs, with given interval.
+*/
+   public static function getDraftTrend( $source, $target, $interval ) {
+   $dbr = Database::getConnection( DB_SLAVE );
+
+   $draftCondition = $dbr->makeList(
+   array(
+   'translation_status' => 'draft',
+   'translation_target_url IS NULL'
+   ),
+   LIST_AND
+   );
+
+   $groupBy = null;
+
+   if ( $interval === 'week' ) {
+   $groupBy = array(
+   'GROUP BY' => array(
+   
'YEARWEEK(translation_last_updated_timestamp)',
+   ),
+   );
+   } elseif ( $interval === 'month' ) {
+   $groupBy = array(
+   'GROUP BY' => array(
+   
'YEAR(translation_last_updated_timestamp), 
MONTH(translation_last_updated_timestamp)',
+   ),
+   );
+   }
+
+   $conditions = array( $draftCondition );
+
+   if ( $source !== null ) {
+   $conditions['translation_source_language'] = $source;
+   }
+
+   if ( $target !== null ) {
+   $conditions['translation_target_language'] = $target;
+   }
+
+   $rows = $dbr->select(
+   array( 'translations' => 'cx_translations' ),
+   array(
+   "DATE_FORMAT( 
translations.translation_last_updated_timestamp, '%Y-%m-%d' ) AS date",
+   '(' . $dbr->selectSQLText(
+   'cx_translations',
+   'count(*)',
+   $dbr->makeList( array(
+   
'translation_last_updated_timestamp <= 
MAX(translations.translation_last_updated_timestamp)',
+   $dbr->makeList( $conditions, 
LIST_AND ),
+   ),
+   LIST_AND )
+   ) . ') translatons_count',
+   ),
+   $dbr->makeList( $conditions, LIST_AND ),
+   __METHOD__,
+   $groupBy
+   );
+
+   $prev = 0;
+   $result = array();
+   foreach ( $rows as $row ) {
+   $count = (int)$row->translatons_count;
+   $result[] = array(
+   

[MediaWiki-commits] [Gerrit] WIP: Deletion count graph - change (mediawiki...ContentTranslation)

2015-09-07 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: WIP: Deletion count graph
..

WIP: Deletion count graph

Change-Id: I8581d07c00dac6228ba5cc8b465acf431a1163e3
---
M api/ApiQueryContentTranslationLanguageTrend.php
M includes/Translation.php
M modules/stats/ext.cx.stats.js
3 files changed, 81 insertions(+), 12 deletions(-)


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

diff --git a/api/ApiQueryContentTranslationLanguageTrend.php 
b/api/ApiQueryContentTranslationLanguageTrend.php
index db17780..3aff780 100644
--- a/api/ApiQueryContentTranslationLanguageTrend.php
+++ b/api/ApiQueryContentTranslationLanguageTrend.php
@@ -35,7 +35,8 @@
array(
'translations' =>

ContentTranslation\Translation::getPublishTrend( $source, $target, $interval ),
-   'drafts' => 
ContentTranslation\Translation::getDraftTrend( $source, $target, $interval )
+   'drafts' => 
ContentTranslation\Translation::getDraftTrend( $source, $target, $interval ),
+   'deletions' =>  
ContentTranslation\Translation::getDeletionTrend( $interval )
)
);
}
diff --git a/includes/Translation.php b/includes/Translation.php
index 59c4a2d..cae0cfc 100644
--- a/includes/Translation.php
+++ b/includes/Translation.php
@@ -291,6 +291,62 @@
}
 
/**
+* Get time-wise cumulative number of drafts for given
+* language pairs, with given interval.
+*/
+   public static function getDeletionTrend( $interval ) {
+   $dbr = wfGetDB( DB_SLAVE );
+
+   $conditions = array(
+   'ar_namespace' => 0,
+   'ct_tag' => 'contenttranslation',
+   'ar_rev_id = ct_rev_id'
+   );
+   $groupBy = null;
+
+   if ( $interval === 'week' ) {
+   $groupBy = array(
+   'GROUP BY' => array(
+   'YEARWEEK(ar_timestamp)',
+   ),
+   );
+   } elseif ( $interval === 'month' ) {
+   $groupBy = array(
+   'GROUP BY' => array(
+   'YEAR(ar_timestamp), 
MONTH(ar_timestamp)',
+   ),
+   );
+   }
+
+   $rows = $dbr->select(
+   array( 'change_tag', 'archive' ),
+   array( 'ar_timestamp', 'count(ar_page_id) as count' ),
+   $conditions,
+   __METHOD__,
+   $groupBy
+   );
+
+   $prev = 0;
+   $count = 0;
+   $result = array();
+   foreach ( $rows as $row ) {
+   $count += (int)$row->count;
+   $result[] = array(
+   'date' => $interval === 'week' ?
+   // Week end date
+   date( 'Y-m-d', strtotime( 
$row->ar_timestamp . ' + ' .
+   ( 6 - date( 'w', strtotime( 
$row->ar_timestamp ) ) ) . ' days' ) ) :
+   date( 'Y-m', strtotime( 
$row->ar_timestamp ) ),
+   'count' => $count,
+   'delta' => $count - $prev,
+   );
+   $prev = $count;
+   }
+
+   return $result;
+   }
+
+   /**
 * Get time-wise cumulative number of translations for given
 * language pairs, with given interval.
 */
diff --git a/modules/stats/ext.cx.stats.js b/modules/stats/ext.cx.stats.js
index 769cba3..6b46e22 100644
--- a/modules/stats/ext.cx.stats.js
+++ b/modules/stats/ext.cx.stats.js
@@ -67,6 +67,7 @@
self.totalDraftTrend = mergeAndFill( 
self.totalTranslationTrend, totalTrend.drafts );
self.languageDraftTrend = mergeAndFill( 
self.languageTranslationTrend, languageTrend.drafts );
self.languageDraftTrend = mergeAndFill( 
self.totalDraftTrend, self.languageDraftTrend );
+   self.languageDeletionTrend = mergeAndFill( 
self.languageTranslationTrend, totalTrend.deletions );
self.renderHighlights();
self.drawCumulativeGraph( 'count' );
self.drawLanguageCumulativeGraph( 'count' );
@@ -499,6 +500,28 @@
} ),
datasets: [

[MediaWiki-commits] [Gerrit] Stats: Generate personal tools before head element - change (mediawiki...ContentTranslation)

2015-09-07 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Stats: Generate personal tools before head element
..

Stats: Generate personal tools before head element

Change-Id: Id604da146dcae601b19ee29536339f98c55f68fb
Followup: I5d024a42421423c5d0c5ebe2123ebdffa5e9c3b2
---
M specials/SpecialContentTranslationStats.php
1 file changed, 3 insertions(+), 4 deletions(-)


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

diff --git a/specials/SpecialContentTranslationStats.php 
b/specials/SpecialContentTranslationStats.php
index c1476fa..07b63fb 100644
--- a/specials/SpecialContentTranslationStats.php
+++ b/specials/SpecialContentTranslationStats.php
@@ -39,7 +39,9 @@
$out->addModules( $defaultSkinModules['legacy'] );
 
Hooks::run( 'BeforePageDisplay', array( &$out, &$skin ) );
-
+   $toolbarList = Html::rawElement( 'ul',
+   null,
+   $skin->getPersonalToolsList() );
$out->addHTML( $out->headElement( $skin ) );
$out->addHTML( Html::element(
'noscript',
@@ -47,9 +49,6 @@
$this->msg( 'cx-javascript' )->text()
) );
$out->addHtml( MWDebug::getDebugHTML( $this->getContext() ) );
-   $toolbarList = Html::rawElement( 'ul',
-   null,
-   $skin->getPersonalToolsList() );
$out->addHTML( Html::rawElement( 'div',
array( 'id' => 'p-personal' ),
$toolbarList ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id604da146dcae601b19ee29536339f98c55f68fb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Stats: Weekly trends - change (mediawiki...ContentTranslation)

2015-09-08 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Stats: Weekly trends
..

Stats: Weekly trends

While doing this, as per Pau's suggestion, I changed
the colors(again).
Translations: Blue, Draft: Gray, Deleted: Red

Bug: T105192
Change-Id: I8301bcd7e595e8144a43622a27503b8ed9494bbf
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M lib/chart.js/Chart.Core.js
M lib/chart.js/Chart.Line.js
M modules/stats/ext.cx.stats.js
M modules/stats/styles/ext.cx.stats.less
7 files changed, 406 insertions(+), 75 deletions(-)


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

diff --git a/extension.json b/extension.json
index c6d051f..76fc319 100644
--- a/extension.json
+++ b/extension.json
@@ -849,6 +849,8 @@
"cx-stats-local-published-number",
"cx-stats-local-published",
"cx-stats-grouping-title",
+   "cx-trend-published-translations-title",
+   "cx-trend-translations-to-title",
"percent"
]
},
@@ -857,7 +859,8 @@
"remoteExtPath": "ContentTranslation/lib",
"scripts": [
"chart.js/Chart.Core.js",
-   "chart.js/Chart.Line.js"
+   "chart.js/Chart.Line.js",
+   "chart.js/Chart.Bar.js"
]
},
"ext.cx.beta.notification": {
diff --git a/i18n/en.json b/i18n/en.json
index e355a1f..567159b 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -164,6 +164,8 @@
"cx-stats-local-published-number": "$1 in $2",
"cx-stats-local-published": "$1 ($3) in $2",
"cx-stats-grouping-title": "{{PLURAL:$1|$1 translation|$1 
translations}}",
+   "cx-trend-published-translations-title": "Translation trend",
+   "cx-trend-translations-to-title": "Translation trend to $1",
"cx-tools-missing-link-text": "{{GENDER:|Mark}} the page as missing to 
encourage its creation.",
"cx-tools-missing-link-tooltip": "Translate (in new window)",
"cx-tools-missing-link-title": "Missing link",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 44cb907..03d15c3 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -169,6 +169,8 @@
"cx-stats-local-published-number": "A message shown in 
[[Special:CXStats]] as highlights of CX analytics. $1 is a number, $2 is 
language name (autonym).",
"cx-stats-local-published": "A message shown in [[Special:CXStats]] as 
highlights of CX analytics. $1 is a number, $2 is language name (autonym), $3 
is percentage.",
"cx-stats-grouping-title": "Title text for language grouping based on 
number of translations. $1 is number of 
translations\n{{Identical|Translation}}",
+   "cx-trend-published-translations-title": "A message shown in 
[[Special:CXStats]]",
+   "cx-trend-translations-to-title": "Label shown in the legend section 
Content translation trends graph visualization.\n* $1 - language name",
"cx-tools-missing-link-text": "Message with instructions for marking 
links as missing",
"cx-tools-missing-link-tooltip": "Tooltip that shows when hovering over 
target link card link when working with missing links.\nClicking on link opens 
a new translation view for the missing link.",
"cx-tools-missing-link-title": "Title for target link card when card is 
used for working with missing links",
diff --git a/lib/chart.js/Chart.Core.js b/lib/chart.js/Chart.Core.js
old mode 100755
new mode 100644
index 5dccd2e..aa6c58d
--- a/lib/chart.js/Chart.Core.js
+++ b/lib/chart.js/Chart.Core.js
@@ -35,17 +35,17 @@
{
return 
document.defaultView.getComputedStyle(element).getPropertyValue(dimension);
}
-   }
+   };
 
-   var width = this.width = 
computeDimension(context.canvas,'Width');
-   var height = this.height = 
computeDimension(context.canvas,'Height');
+   var width = this.width = 
computeDimension(context.canvas,'Width') || context.canvas.width;
+   var height = this.height = 
computeDimension(context.canvas,'Height') || context.canvas.height;
 
// Firefox requires this to work correctly
context.canvas.width  = width;
context.canvas.height = height;
 
-   var width = this.width = context.canvas.width;
-   var height = this.height = context.canvas.height;
+   width = this.width = context.canvas.width;
+   height = this.height = context.canvas.height;
this.aspectRatio = this.wid

[MediaWiki-commits] [Gerrit] While adapting references, Validate whether the source has r... - change (mediawiki...ContentTranslation)

2015-07-06 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: While adapting references, Validate whether the source has 
references list
..

While adapting references, Validate whether the source has references list

Testplan:
Translate the following article to any language
https://en.wikipedia.org/w/index.php?title=Samsung_Galaxy_A7&oldid=668069510
You will notice that the references list is missing in loaded source article.
Use source as translation and translate all sections, publish.
Publish will fail without this patch.

Bug: T104947
Change-Id: I198f5c62b78a7b9e8cf0b613e3e5a870b4c8b2fd
---
M modules/tools/ext.cx.tools.reference.js
1 file changed, 14 insertions(+), 1 deletion(-)


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

diff --git a/modules/tools/ext.cx.tools.reference.js 
b/modules/tools/ext.cx.tools.reference.js
index f85293d..c44a7ad 100644
--- a/modules/tools/ext.cx.tools.reference.js
+++ b/modules/tools/ext.cx.tools.reference.js
@@ -323,7 +323,20 @@
}
 
function processReferences( $section ) {
-   var $sourceSection, referenceAdaptor, isRestoredFromDraft;
+   var $sourceSection, referenceAdaptor, isRestoredFromDraft, 
$referenceLists;
+
+   $referenceLists = $( '[typeof*="mw:Extension/references"]' );
+   if ( !$referenceLists.length ) {
+   // No references list!. There can be multiple reasons 
for this.
+   // (a) References list section use a template that we 
cannot adapt & filtered out from source.
+   // (b) References are in multi-part template that we 
cannot process at this point.
+   // Or any unknown reason. But if we adapt a reference 
without reference list at the
+   // translation, parsoid will fail causing publishing 
failure. That is serious issue and
+   // we are avoiding it.
+   mw.log( '[CX] References list not found in source 
article. References will be removed' );
+   $section.find( '[typeof*="mw:Extension/ref"]' 
).remove();
+   return;
+   }
 
isRestoredFromDraft = $section.data( 'cx-draft' ) === true;
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I198f5c62b78a7b9e8cf0b613e3e5a870b4c8b2fd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Update extension version - change (mediawiki...ContentTranslation)

2015-07-09 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Update extension version
..

Update extension version

Change-Id: I0b3070e747e68d8fa8af6add5c5af5eedebba45a
---
M extension.json
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/extension.json b/extension.json
index 5c2d65f..228bf2c 100644
--- a/extension.json
+++ b/extension.json
@@ -1,6 +1,6 @@
 {
"name": "ContentTranslation",
-   "version": "1.0.0+20150401",
+   "version": "1.0.0+20150710",
"author": [
"Amir Aharoni",
"David Chan",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0b3070e747e68d8fa8af6add5c5af5eedebba45a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix syntax errors in the sql query - change (analytics/limn-language-data)

2015-07-10 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Fix syntax errors in the sql query
..

Fix syntax errors in the sql query

Wiki codes like 'as', 'or', 'is', 'to' are reserved keywords in sql.
They are now escaped using `.

Change-Id: I05914b5f62418fdeb5457b530e50aebe8c88875e
---
M language/content_translation_beta.sql
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/limn-language-data 
refs/changes/20/224220/1

diff --git a/language/content_translation_beta.sql 
b/language/content_translation_beta.sql
index df759c6..b1e949f 100644
--- a/language/content_translation_beta.sql
+++ b/language/content_translation_beta.sql
@@ -502,7 +502,7 @@
 left join
 ( select count(*) as vepwiki from vepwiki.user_properties 
where up_property = 'cx' and up_value = 1 ) vep on 1=1
 left join
-( select count(*) as aswiki from aswiki.user_properties where 
up_property = 'cx' and up_value = 1 ) as on 1=1
+( select count(*) as aswiki from aswiki.user_properties where 
up_property = 'cx' and up_value = 1 ) `as` on 1=1
 left join
 ( select count(*) as bnwiki from bnwiki.user_properties where 
up_property = 'cx' and up_value = 1 ) bn on 1=1
 left join
@@ -524,7 +524,7 @@
 left join
 ( select count(*) as newwiki from newwiki.user_properties 
where up_property = 'cx' and up_value = 1 ) new on 1=1
 left join
-( select count(*) as orwiki from orwiki.user_properties where 
up_property = 'cx' and up_value = 1 ) or on 1=1
+( select count(*) as orwiki from orwiki.user_properties where 
up_property = 'cx' and up_value = 1 ) `or` on 1=1
 left join
 ( select count(*) as piwiki from piwiki.user_properties where 
up_property = 'cx' and up_value = 1 ) pi on 1=1
 left join
@@ -644,7 +644,7 @@
 left join
 ( select count(*) as tetwiki from tetwiki.user_properties 
where up_property = 'cx' and up_value = 1 ) tet on 1=1
 left join
-( select count(*) as towiki from towiki.user_properties where 
up_property = 'cx' and up_value = 1 ) to on 1=1
+( select count(*) as towiki from towiki.user_properties where 
up_property = 'cx' and up_value = 1 ) `to` on 1=1
 left join
 ( select count(*) as tywiki from tywiki.user_properties where 
up_property = 'cx' and up_value = 1 ) ty on 1=1
 left join
@@ -668,7 +668,7 @@
 left join
 ( select count(*) as ikwiki from ikwiki.user_properties where 
up_property = 'cx' and up_value = 1 ) ik on 1=1
 left join
-( select count(*) as iswiki from iswiki.user_properties where 
up_property = 'cx' and up_value = 1 ) is on 1=1
+( select count(*) as iswiki from iswiki.user_properties where 
up_property = 'cx' and up_value = 1 ) `is` on 1=1
 left join
 ( select count(*) as klwiki from klwiki.user_properties where 
up_property = 'cx' and up_value = 1 ) kl on 1=1
 ) seventh30

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I05914b5f62418fdeb5457b530e50aebe8c88875e
Gerrit-PatchSet: 1
Gerrit-Project: analytics/limn-language-data
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] fetchLinkData of CXLink class must return jQuery.Promise - change (mediawiki...ContentTranslation)

2015-07-13 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: fetchLinkData of CXLink class must return jQuery.Promise
..

fetchLinkData of CXLink class must return jQuery.Promise

An early return when title is null was causing js error

Testplan:
Translate the article La Gioconda (còpia del Museu del Prado)
from ca to en.
Click on first paragraph, you will see placeholder filled
with initial translation. Second paragraph onwards nothing
happens and a js error appears in console:
Uncaught TypeError: Cannot read property 'then' of undefined
With this patch, the js error should go away and placeholders
should work as expected.

Bug: T105687
Change-Id: I7565a3e2c9ee1bc5870314465e3f5b478e8addfa
---
M modules/tools/ext.cx.tools.link.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index b3ad055..8629bfd 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -320,7 +320,7 @@
 
title = this.getTitle();
if ( !title ) {
-   return;
+   return $.Deferred().reject().promise();
}
 
api = this.siteMapper.getApi( language );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7565a3e2c9ee1bc5870314465e3f5b478e8addfa
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add two hooks entries missed in extension.json - change (mediawiki...UniversalLanguageSelector)

2015-07-14 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Add two hooks entries missed in extension.json
..

Add two hooks entries missed in extension.json

Change-Id: Ic53d79f7d8f7277e0768c1e461ae5d33c997a444
---
M extension.json
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/07/224607/1

diff --git a/extension.json b/extension.json
index 7625015..85e86ac 100644
--- a/extension.json
+++ b/extension.json
@@ -23,7 +23,9 @@
"ResourceLoaderGetConfigVars": 
"UniversalLanguageSelectorHooks::addConfig",
"ResourceLoaderTestModules": 
"UniversalLanguageSelectorHooks::addTestModules",
"SkinTemplateOutputPageBeforeExec": 
"UniversalLanguageSelectorHooks::onSkinTemplateOutputPageBeforeExec",
-   "UserGetLanguageObject": 
"UniversalLanguageSelectorHooks::getLanguage"
+   "UserGetLanguageObject": 
"UniversalLanguageSelectorHooks::getLanguage",
+   "GetBetaFeaturePreferences": 
"UniversalLanguageSelectorHooks::onGetBetaFeaturePreferences",
+   "GetPreferences": 
"UniversalLanguageSelectorHooks::onGetPreferences"
},
"APIModules": {
"languagesearch": "ApiLanguageSearch",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic53d79f7d8f7277e0768c1e461ae5d33c997a444
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Gallery: Adapt the image namespaces to canonical File namespace - change (mediawiki...ContentTranslation)

2015-07-14 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Gallery: Adapt the image namespaces to canonical File namespace
..

Gallery: Adapt the image namespaces to canonical File namespace

Bug: T105799
Change-Id: Id48116cca70444f7a6c6daf7c34d5e3acb8db814
---
M modules/tools/ext.cx.tools.gallery.js
1 file changed, 5 insertions(+), 2 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.gallery.js 
b/modules/tools/ext.cx.tools.gallery.js
index f44cee2..581bdb5 100644
--- a/modules/tools/ext.cx.tools.gallery.js
+++ b/modules/tools/ext.cx.tools.gallery.js
@@ -13,7 +13,7 @@
 
function adaptGallery( $section ) {
var i, $sourceSection, galleryData, galleryWikiMarkup = '',
-   imageItems, caption, imageIndex = 0;
+   imageItems, caption, imageTitle, imageIndex = 0;
 
if ( !$section.is( '[typeof*="mw:Extension/gallery"]' ) ) {
return;
@@ -29,8 +29,11 @@
// FIXME: Copying plain text of gallery text 
will definitely lose the html
// mark up in translation. What we need is 
Wikitext of the translated HTML.
// That require a restbase api call.
+   imageTitle = imageItems[ i ].split( '|' )[ 0 ];
+   // Change the image namespace to canonical 
File: namespace.
+   imageTitle = imageTitle.replace( /(.+)(:)/g, 
'File' + '$2' );
caption = $section.find( '.gallerytext' ).eq( 
imageIndex ).text().trim();
-   imageItems[ i ] = [ imageItems[ i ].split( '|' 
)[ 0 ], caption ].join( '|' );
+   imageItems[ i ] = [ imageTitle, caption ].join( 
'|' );
imageIndex++;
}
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id48116cca70444f7a6c6daf7c34d5e3acb8db814
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix PHP errors - change (mediawiki...ContentTranslation)

2015-08-31 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Fix PHP errors
..

Fix PHP errors

* SiteMapper.php was throwing error about undefined $domain.
* manage-lists.php was throwing error about undefined $param

Change-Id: I7faf6185b5f4bf936e4525576757cc0a96b65353
---
M includes/SiteMapper.php
M scripts/manage-lists.php
2 files changed, 3 insertions(+), 3 deletions(-)


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

diff --git a/includes/SiteMapper.php b/includes/SiteMapper.php
index f6d7a7b..0ed3801 100644
--- a/includes/SiteMapper.php
+++ b/includes/SiteMapper.php
@@ -15,7 +15,7 @@
return 
$wgContentTranslationDomainCodeMapping[$language];
}
 
-   return $domain;
+   return $language;
}
 
 
diff --git a/scripts/manage-lists.php b/scripts/manage-lists.php
index 074f4ea..e635793 100644
--- a/scripts/manage-lists.php
+++ b/scripts/manage-lists.php
@@ -123,8 +123,8 @@
if ( !isset( $data['continue'] ) || count( $pages ) > 
5000 ) {
break;
} else {
-   unset( $param['llcontinue'] );
-   unset( $param['gcmcontinue'] );
+   unset( $params['llcontinue'] );
+   unset( $params['gcmcontinue'] );
$params += $data['continue'];
}
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7faf6185b5f4bf936e4525576757cc0a96b65353
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix: Redlink in link card opens CX with incorrect source page - change (mediawiki...ContentTranslation)

2015-07-15 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Fix: Redlink in link card opens CX with incorrect source page
..

Fix: Redlink in link card opens CX with incorrect source page

Testplan:
Create a red link and clik on the link in the link tool card.
CX should open with source article as the text of the redlink

Bug: T105915
Change-Id: Ic4b30d5d0cfaae37ae9c30c0ae3f29b536b74680
---
M modules/tools/ext.cx.tools.link.js
1 file changed, 5 insertions(+), 1 deletion(-)


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

diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index 8629bfd..68339d0 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -417,7 +417,11 @@
target: '_blank',
title: mw.msg( 
'cx-tools-missing-link-tooltip' ),
href: new mw.Uri().extend( {
-   targettitle: 
this.getTitle()
+   targettitle: 
this.getTitle(),
+   // This is a non 
existing link and we cannot guess what can be the source,
+   // So using the same 
link text for now.
+   page: this.getTitle(),
+   draft: null
} ).toString()
} );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic4b30d5d0cfaae37ae9c30c0ae3f29b536b74680
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Make the height of search input field same as its container - change (mediawiki...ContentTranslation)

2015-07-15 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Make the height of search input field same as its container
..

Make the height of search input field same as its container

Bug: T105960
Change-Id: I916c2add6cec3fe193de424a9d98a5e6cd08ccb0
---
M modules/tools/styles/ext.cx.tools.less
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/tools/styles/ext.cx.tools.less 
b/modules/tools/styles/ext.cx.tools.less
index e044684..9fa84ff 100644
--- a/modules/tools/styles/ext.cx.tools.less
+++ b/modules/tools/styles/ext.cx.tools.less
@@ -10,7 +10,7 @@
 .cx-card--search__input {
font-size: 16px;
width: 100%;
-   height: 100%;
+   height: 2.5em;
border: none;
background: none;
outline: none;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I916c2add6cec3fe193de424a9d98a5e6cd08ccb0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Reduce the size of icons in dashboard to match the font size - change (mediawiki...ContentTranslation)

2015-07-15 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Reduce the size of icons in dashboard to match the font size
..

Reduce the size of icons in dashboard to match the font size

Bug: T105962
Change-Id: I1d21ef1046f6b60fe39bfb1c1c71a3a1307997bf
---
M modules/dashboard/styles/ext.cx.dashboard.less
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/dashboard/styles/ext.cx.dashboard.less 
b/modules/dashboard/styles/ext.cx.dashboard.less
index 8341a45..926 100644
--- a/modules/dashboard/styles/ext.cx.dashboard.less
+++ b/modules/dashboard/styles/ext.cx.dashboard.less
@@ -56,7 +56,7 @@
padding: 30px 40px;
background-position: center left;
background-repeat: no-repeat;
-   background-size: 25px;
+   background-size: 20px;
}
 
&__title {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1d21ef1046f6b60fe39bfb1c1c71a3a1307997bf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Style improvements for page selector - change (mediawiki...ContentTranslation)

2015-07-15 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Style improvements for page selector
..

Style improvements for page selector

* All items should have the same height.
* All images should occupy the same (square) area.
* Articles without an image should show a generic article placeholder.

Bug: T105966
Change-Id: I4ba24b76dcc354034c7e2b474a05b1dff24876c8
---
M modules/widgets/pageselector/ext.cx.pageselector.js
M modules/widgets/pageselector/ext.cx.pageselector.less
A modules/widgets/pageselector/page-placeholder.png
A modules/widgets/pageselector/page-placeholder.svg
4 files changed, 5 insertions(+), 2 deletions(-)


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

diff --git a/modules/widgets/pageselector/ext.cx.pageselector.js 
b/modules/widgets/pageselector/ext.cx.pageselector.js
index 898d83c..31dafbe 100644
--- a/modules/widgets/pageselector/ext.cx.pageselector.js
+++ b/modules/widgets/pageselector/ext.cx.pageselector.js
@@ -93,8 +93,7 @@
);
if ( page.thumbnail ) {
$resultItem.css( {
-   'background-image': 'url(' + 
page.thumbnail.source + ')',
-   'background-size': 
page.thumbnail.width + 'px ' + page.thumbnail.height + 'px'
+   'background-image': 'url(' + 
page.thumbnail.source + ')'
} );
}
self.$menu.append( $resultItem );
diff --git a/modules/widgets/pageselector/ext.cx.pageselector.less 
b/modules/widgets/pageselector/ext.cx.pageselector.less
index 7333275..df577c4 100644
--- a/modules/widgets/pageselector/ext.cx.pageselector.less
+++ b/modules/widgets/pageselector/ext.cx.pageselector.less
@@ -1,3 +1,4 @@
+@import "mediawiki.mixins";
 .mw-pageselector-menu {
position: absolute;
border: 1px solid #ccc;
@@ -16,6 +17,8 @@
background-position: left center;
background-size: 50px 50px;
padding: 5px 5px 5px 60px;
+   min-height: 40px;
+   .background-image-svg('page-placeholder.svg', 
'page-placeholder.png');
}
 
li.mw-pageselector-selected {
diff --git a/modules/widgets/pageselector/page-placeholder.png 
b/modules/widgets/pageselector/page-placeholder.png
new file mode 100644
index 000..6a79e7b
--- /dev/null
+++ b/modules/widgets/pageselector/page-placeholder.png
Binary files differ
diff --git a/modules/widgets/pageselector/page-placeholder.svg 
b/modules/widgets/pageselector/page-placeholder.svg
new file mode 100644
index 000..6e27a49
--- /dev/null
+++ b/modules/widgets/pageselector/page-placeholder.svg
@@ -0,0 +1 @@
+http://www.w3.org/2000/svg"; width="24" height="24" viewBox="0 0 24 
24">

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4ba24b76dcc354034c7e2b474a05b1dff24876c8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Contribution hover menu icon and layout adjustments - change (mediawiki...ContentTranslation)

2015-07-15 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Contribution hover menu icon and layout adjustments
..

Contribution hover menu icon and layout adjustments

* Icons are verically centered
* Reduced the min-width of menu from 250px to 200px

Bug: T105961
Change-Id: I0e72e4cc206d68e968f3e926990fe4fe7e21f01a
---
M modules/campaigns/styles/ext.cx.campaigns.contributionsmenu.less
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/modules/campaigns/styles/ext.cx.campaigns.contributionsmenu.less 
b/modules/campaigns/styles/ext.cx.campaigns.contributionsmenu.less
index e2cd9e2..f988ab7 100644
--- a/modules/campaigns/styles/ext.cx.campaigns.contributionsmenu.less
+++ b/modules/campaigns/styles/ext.cx.campaigns.contributionsmenu.less
@@ -13,9 +13,9 @@
padding: 5px 10px 5px 40px;
margin: 0;
border-bottom: 1px solid #ccc;
-   min-width: 250px;
+   min-width: 200px;
background-size: 24px;
-   background-position: left 5px top 5px;
+   background-position: left 10px center;
background-repeat: no-repeat;
 
a {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0e72e4cc206d68e968f3e926990fe4fe7e21f01a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Reduce the z-index of callout to a reasonable level - change (mediawiki...ContentTranslation)

2015-07-15 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Reduce the z-index of callout to a reasonable level
..

Reduce the z-index of callout to a reasonable level

It had a huge z-index causing IME selector hidden under it.

Bug: T105954
Change-Id: I78a206c449309237efa04889dbdef536b8af3b2a
---
M modules/widgets/callout/ext.cx.callout.css
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/widgets/callout/ext.cx.callout.css 
b/modules/widgets/callout/ext.cx.callout.css
index 9fbf067..0531b32 100644
--- a/modules/widgets/callout/ext.cx.callout.css
+++ b/modules/widgets/callout/ext.cx.callout.css
@@ -7,7 +7,7 @@
border: 1px solid #ccc;
border-radius: 3px;
max-width: 500px;
-   z-index: 10;
+   z-index: 999;
 }
 
 .cx-callout::after, .cx-callout::before  {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I78a206c449309237efa04889dbdef536b8af3b2a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Dashboard: Use the available horizontal space for titles - change (mediawiki...ContentTranslation)

2015-07-22 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Dashboard: Use the available horizontal space for titles
..

Dashboard: Use the available horizontal space for titles

Made it to use 80% instead of 50%.
See https://www.mediawiki.org/wiki/Topic:Slic5k7ei5a8p76n

Change-Id: Iadbed7d4eefdc57c03c8242ccb561d2f51ab5736
---
M modules/dashboard/styles/ext.cx.translationlist.less
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/dashboard/styles/ext.cx.translationlist.less 
b/modules/dashboard/styles/ext.cx.translationlist.less
index b346395..56d856b 100644
--- a/modules/dashboard/styles/ext.cx.translationlist.less
+++ b/modules/dashboard/styles/ext.cx.translationlist.less
@@ -129,7 +129,7 @@
}
 
.cx-tlitem__details {
-   .mw-ui-one-half;
+   .mw-ui-four-fifths;
 
position: relative;
height: 100px;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iadbed7d4eefdc57c03c8242ccb561d2f51ab5736
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Attach link handlers to redlinks after restoring the draft - change (mediawiki...ContentTranslation)

2015-06-30 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Attach link handlers to redlinks after restoring the draft
..

Attach link handlers to redlinks after restoring the draft

The redlinks were missing rel=mw:WikiLink attributes and because of that
the link handlers were not attached.

Testplan:
Do a translation. Make some link red. Save. Restore. See the redlink
is still present and clicking on it brings link card

Change-Id: I176d1030b1a46e995ed85ffafe1ed693cdacb6ae
---
M modules/tools/ext.cx.tools.link.js
1 file changed, 5 insertions(+), 1 deletion(-)


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

diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index 7643038..b3ad055 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -246,7 +246,11 @@
return;
}
}
-   this.$link.removeClass( 'cx-target-link-unadapted' ).addClass( 
'new' );
+
+   this.$link
+   .attr( 'rel', 'mw:WikiLink' )
+   .removeClass( 'cx-target-link-unadapted' )
+   .addClass( 'new' );
};
 
CXLink.prototype.isRedLink = function () {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I176d1030b1a46e995ed85ffafe1ed693cdacb6ae
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Load ext.cite.style once the source article loaded - change (mediawiki...ContentTranslation)

2015-07-01 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Load ext.cite.style once the source article loaded
..

Load ext.cite.style once the source article loaded

This module is defined in Cite extension. So we cannot load
it unconditionally. Hence loading in a try-catch block.

Loading is delayed till the article is ready.

Testplan:
Configure cxserver to use RESTBase beta instance.
http://restbase-beta.wmflabs.org/@lang.wikipedia.beta.wmflabs.org/v1/page/html/@title
Restart cxserver and load any article from enwiki(beta labs).
For example: African linsang article.
Without the Cite extension, the references at the bottom of article will
look like
1. ↑ 1 2 3...
With Cite extension, the numbers after up-arrow will look like super scripts.

Bug: T99870

Change-Id: I7da47f5ce1c1df322e04fb86961a0e2795cced6e
---
M modules/source/ext.cx.source.js
1 file changed, 6 insertions(+), 0 deletions(-)


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

diff --git a/modules/source/ext.cx.source.js b/modules/source/ext.cx.source.js
index cda252c..d7efeea 100644
--- a/modules/source/ext.cx.source.js
+++ b/modules/source/ext.cx.source.js
@@ -153,6 +153,12 @@
this.$content.find( 'base' ).detach();
 
mw.hook( 'mw.cx.source.ready' ).fire();
+   // Try to load ext.cite.style module. If Cite extension is not 
present, this can fail.
+   try {
+   mw.loader.using( 'ext.cite.style' );
+   } catch ( e ) {
+   mw.log( 'Could not load ext.cite.style, References will 
fallback to default style' );
+   }
};
 
/**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7da47f5ce1c1df322e04fb86961a0e2795cced6e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Lineardoc: Do not skip tags with empty content but with attr... - change (mediawiki...cxserver)

2015-07-02 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Lineardoc: Do not skip tags with empty content but with 
attributes
..

Lineardoc: Do not skip tags with empty content but with attributes

Those attributes are important and sometimes contain information for
parsoid to work with references or templates.

Added tests to verify lineardoc is not eating up empty tags

Bug: T104539
Change-Id: I4cca925cb35a00fa27fd31380fae90e1c4c2767f
---
M lineardoc/Builder.js
M tests/lineardoc/LinearDoc.test.js
A tests/lineardoc/data/test3-result.xhtml
A tests/lineardoc/data/test3-result.xml
A tests/lineardoc/data/test3.xhtml
5 files changed, 85 insertions(+), 2 deletions(-)


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

diff --git a/lineardoc/Builder.js b/lineardoc/Builder.js
index 15f806c..5df6a53 100644
--- a/lineardoc/Builder.js
+++ b/lineardoc/Builder.js
@@ -58,7 +58,11 @@
'Mismatched inline tags: open=' + ( tag && tag.name ) + 
', close=' + tagName
);
}
-   if ( tag.name !== 'span' || !tag.attributes[ 'data-mw' ] ) {
+
+   if ( !Object.keys( tag.attributes).length ) {
+   // if the tag has no attributes, we can safeley assume that
+   // we not check for empy/whitespace only tags. Otherwise, we 
might be skipping
+   // important tags just because it has no content. See Bug 
T104539
return tag;
}
// Check for empty/whitespace-only data span. Replace as inline content
diff --git a/tests/lineardoc/LinearDoc.test.js 
b/tests/lineardoc/LinearDoc.test.js
index 745fb36..13a1007 100644
--- a/tests/lineardoc/LinearDoc.test.js
+++ b/tests/lineardoc/LinearDoc.test.js
@@ -6,7 +6,7 @@
 QUnit.test( 'LinearDoc tests', function ( assert ) {
var parser, testXhtmlFile, resultXmlFile, resultXhtmlFile, testXhtml, 
resultXml,
resultXhtml, i,
-   numTests = 2;
+   numTests = 3;
QUnit.expect( 2 * numTests );
for ( i = 1; i <= numTests; i++ ) {
testXhtmlFile = __dirname + '/data/test' + i + '.xhtml';
diff --git a/tests/lineardoc/data/test3-result.xhtml 
b/tests/lineardoc/data/test3-result.xhtml
new file mode 100644
index 000..d6ac7fa
--- /dev/null
+++ b/tests/lineardoc/data/test3-result.xhtml
@@ -0,0 +1,14 @@
+
+
+
+test
+
+
+
+
+↑ 

+http://lhermanto-resepkeluarga.blogspot.com/2008/04/telor-bumbu-bali-bali-seasoning.html";
 rel="mw:ExtLink">
+
+
+
+
diff --git a/tests/lineardoc/data/test3-result.xml 
b/tests/lineardoc/data/test3-result.xml
new file mode 100644
index 000..f0bc5b3
--- /dev/null
+++ b/tests/lineardoc/data/test3-result.xml
@@ -0,0 +1,51 @@
+
+
+
+
+cxtextblock { border: solid #88f 1px }
+cxtextchunk { border-right: solid #f88 1px }
+
+  

+  
+
+  
+  

+
+
+
+  test
+
+
+
+
+
+
+
+
+
+
+
+  

+  ↑ 
+  
+
+
+
+
+  
+  

+  
+
+
+
+
+  
+  

+
+
+
+
+
+
+
+
diff --git a/tests/lineardoc/data/test3.xhtml b/tests/lineardoc/data/test3.xhtml
new file mode 100644
index 000..03339e0
--- /dev/null
+++ b/tests/lineardoc/data/test3.xhtml
@@ -0,0 +1,14 @@
+
+
+
+test
+
+
+
+
+↑ 

+http://lhermanto-resepkeluarga.blogspot.com/2008/04/telor-bumbu-bali-bali-seasoning.html";
 
data-parsoid="{"targetOff":4337,"contentOffsets":[4337,4337],"dsr":[4248,4338,89,1]}">
+
+
+
+

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4cca925cb35a00fa27fd31380fae90e1c4c2767f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/cxserver
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Test a conservative sans-serif font-stack with Autonym font - change (mediawiki...UniversalLanguageSelector)

2014-01-15 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Test a conservative sans-serif font-stack with Autonym font
..

Test a conservative sans-serif font-stack with Autonym font

To check how it renders in different platforms.

Change-Id: I5cf7b2e53a0f711fef32014cb72f7f4850857ac7
---
M tests/autonym.html
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/64/107564/1

diff --git a/tests/autonym.html b/tests/autonym.html
index 8ff1810..48626b7 100644
--- a/tests/autonym.html
+++ b/tests/autonym.html
@@ -42,6 +42,7 @@
sans-serif
Autonym, sans-serif
sans-serif, Autonym
+   Verdana, 
Arial, Helvetica, Autonym, sans-serif
 
 
Select size (px)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5cf7b2e53a0f711fef32014cb72f7f4850857ac7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add an abbreviated alias for Special:ContentTranslation as S... - change (mediawiki...ContentTranslation)

2014-01-15 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Add an abbreviated alias for Special:ContentTranslation as 
Special:CX
..

Add an abbreviated alias for Special:ContentTranslation as Special:CX

Change-Id: I2030cc2e390e5b380d30e491eb2acb7eb1ccb64f
---
M ContentTranslation.alias.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/ContentTranslation.alias.php b/ContentTranslation.alias.php
index 70108c9..9046af8 100644
--- a/ContentTranslation.alias.php
+++ b/ContentTranslation.alias.php
@@ -13,7 +13,7 @@
 
 /** English (English) */
 $specialPageAliases['en'] = array(
-   'ContentTranslation' => array( 'ContentTranslation' ),
+   'ContentTranslation' => array( 'ContentTranslation', 'CX' ),
 );
 
 /** Malayalam (മലയാളം) */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2030cc2e390e5b380d30e491eb2acb7eb1ccb64f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Reverse the font stack with Autonym font - change (mediawiki...UniversalLanguageSelector)

2014-01-16 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Reverse the font stack with Autonym font
..

Reverse the font stack with Autonym font

All browsers try 'Autonym' first and then fallback font
if the font stack is 'Autonym', sans-serif

But they differ in the way they interpret a font stack like
sans-serif, 'Autonym'

* Chrome and IE uses generic families at the end no matter whether it is given
  at the beginning of font stack. So 'Autonym' font will be downloaded always.
  But that is only about download. While rendering, Chrome uses system fonts
  first and then Autonym font. But experiments shows that it does not resolve
  the fallback chain, just uses one font for sans-serif and uses 'Autonym' font
  as second font. So usually Latin glyphs get rendered from system fonts and
  non-latin fonts rendered from Autonym font.

* FF also downloads Autonym font always. But while rendering it resolves the
  full fallback chain. Non-latin text also get rendered using system font and
  Autonym font is used only when system does not have font.

So this patch does not make any difference for font download. But we improve
the bad rendering of webfonts in old Windows browsers. Since they start using
system font for latin languages, at least they look better.

Refer: https://www.mediawiki.org/wiki/Universal_Language_Selector/WebFonts

Change-Id: I99b3b4938d8fcb6cd5d67f7bbceb5f6443e98451
---
M resources/css/ext.uls.webfonts.css
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/29/107829/1

diff --git a/resources/css/ext.uls.webfonts.css 
b/resources/css/ext.uls.webfonts.css
index eb348f9..05b6dc2 100644
--- a/resources/css/ext.uls.webfonts.css
+++ b/resources/css/ext.uls.webfonts.css
@@ -1,4 +1,4 @@
 #p-lang li.interlanguage-link,
 .autonym { /* provide autonym class for simplifying the Autonym font usage */
-   font-family: 'Autonym', sans-serif;
+   font-family: sans-serif, 'Autonym';
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I99b3b4938d8fcb6cd5d67f7bbceb5f6443e98451
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Detect tofu before applying any default fonts - change (mediawiki...UniversalLanguageSelector)

2014-01-17 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Detect tofu before applying any default fonts
..

Detect tofu before applying any default fonts

To detect whether the client can render a given string, use a tofu
detection algorithm

If the user has a font preference, do not override

If the user has no preference and there is a default font for a
language, see if that language can be rendered at users browser
(tofu detection)

If tofu detected, apply the font.

If the element has 'autonym' class, apply Autonym font only when
that language has tofu.

Change-Id: Ib9ee9497e6bcfa7eb86f7d264e0980d8880d6b70
---
M Resources.php
M UniversalLanguageSelector.php
M lib/jquery.webfonts.js
D resources/css/ext.uls.webfonts.css
M resources/js/ext.uls.webfonts.js
5 files changed, 93 insertions(+), 18 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/24/108024/1

diff --git a/Resources.php b/Resources.php
index 4642721..2b5b70b 100644
--- a/Resources.php
+++ b/Resources.php
@@ -143,10 +143,10 @@
 
 $wgResourceModules['ext.uls.webfonts'] = array(
'scripts' => 'resources/js/ext.uls.webfonts.js',
-   'styles' => 'resources/css/ext.uls.webfonts.css',
'dependencies' => array(
'jquery.webfonts',
'ext.uls.init',
+   'jquery.uls.data',
'ext.uls.webfonts.repository',
'ext.uls.preferences',
),
diff --git a/UniversalLanguageSelector.php b/UniversalLanguageSelector.php
index b98d920..e369db6 100644
--- a/UniversalLanguageSelector.php
+++ b/UniversalLanguageSelector.php
@@ -155,7 +155,7 @@
  * Autonym
  * @since 2013.09
  */
-$GLOBALS['wgULSNoWebfontsSelectors'] = array( '.autonym' );
+$GLOBALS['wgULSNoWebfontsSelectors'] = array();
 
 /**
  * Base path of ULS font repository.
diff --git a/lib/jquery.webfonts.js b/lib/jquery.webfonts.js
index 63c34f6..e7ce234 100644
--- a/lib/jquery.webfonts.js
+++ b/lib/jquery.webfonts.js
@@ -58,13 +58,14 @@
/**
 * Get the default font family for given language.
 * @param {String} language Language code.
+* @param {array} classes
 * @return {String} Font family name
 */
-   getFont: function( language ) {
+   getFont: function( language, classes ) {
language = ( language || this.language ).toLowerCase();
 
if ( this.options.fontSelector ) {
-   return this.options.fontSelector( 
this.repository, language );
+   return this.options.fontSelector( 
this.repository, language, classes );
} else {
return this.repository.defaultFont( language );
}
@@ -199,7 +200,6 @@
// Note: it depends on the browser whether this 
returns font names
// which don't exist. In Chrome it does, while 
in Opera it doesn't.
fontFamilyStyle = $element.css( 'fontFamily' );
-
// Note: It is unclear whether this can ever be 
falsy. Maybe also
// browser specific.
if ( fontFamilyStyle ) {
@@ -220,7 +220,7 @@
// browser settings.
return;
} else {
-   fontFamily = webfonts.getFont( 
element.lang );
+   fontFamily = webfonts.getFont( 
element.lang, element.className.split(/\s+/) );
}
 
if ( !fontFamily ) {
@@ -269,8 +269,8 @@
 
// whether the font is inherited from top element to 
which plugin applied
return this.$element.css( 'fontFamily' ) !== 
elementFontFamily
-   // whether the element has generic font family
-   && ( $.inArray( elementFontFamily,
+   // whether the element has generic font 
family
+   && ( $.inArray( elementFontFamily,
['monospace', 'serif', 
'cursive','fantasy', 'sans-serif'] ) < 0 );
},
 
diff --git a/resources/css/ext.uls.webfonts.css 
b/resources/css/ext.uls.webfonts.css
deleted file mode 100644
index 05b6dc2..000
--- a/resources/css/ext.uls.webfonts.css
+++ /dev/null
@@ -1,4 +0,0 @@
-#p-lang li.interlanguage-link,
-.autonym { /* provide autonym class for simplifying the Autonym font usage */
-   

[MediaWiki-commits] [Gerrit] Add widget elements as member variables to the class - change (mediawiki...ContentTranslation)

2014-01-17 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Add widget elements as member variables to the class
..

Add widget elements as member variables to the class

Change-Id: I2c9bb0ddc2d5451f2f7e0015efe97488742644f0
---
M modules/source/ext.cx.source.js
M modules/translation/ext.cx.translation.js
2 files changed, 12 insertions(+), 4 deletions(-)


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

diff --git a/modules/source/ext.cx.source.js b/modules/source/ext.cx.source.js
index 6d39846..8f34bc1 100644
--- a/modules/source/ext.cx.source.js
+++ b/modules/source/ext.cx.source.js
@@ -20,6 +20,8 @@
this.$container = $( element );
this.options = $.extend( true, {}, $.fn.cxSource.defaults, 
options );
this.page = null;
+   this.$title = null;
+   this.$content = null;
this.init();
}
 
@@ -49,6 +51,8 @@
.addClass( 'cx-column__content' )
.text( mw.msg( 'cx-source-loading', this.page ) 
)
);
+   this.$title = this.$container.find( '.cx-column__title' );
+   this.$content = this.$container.find( '.cx-column__content' );
};
 
ContentTranslationSource.prototype.load = function () {
@@ -60,14 +64,14 @@
page: this.page,
disablepp: true
} ).done( function ( result ) {
-   cxSource.$container.find( '.cx-column__title' ).html( 
result.parse.title );
-   cxSource.$container.find( '.cx-column__content' ).html( 
result.parse.text['*'] );
+   cxSource.$title.html( result.parse.title );
+   cxSource.$content.html( result.parse.text['*'] );
} );
 
};
 
ContentTranslationSource.prototype.listen = function () {
-   this.$container.find( '.cx-column__content' ).on( 'click', 
function () {
+   this.$content.on( 'click', function () {
mw.hook( 'mw.cx.translation.add' ).fire( $( this 
).html() );
} );
};
diff --git a/modules/translation/ext.cx.translation.js 
b/modules/translation/ext.cx.translation.js
index 07946f1..e38d3a3 100644
--- a/modules/translation/ext.cx.translation.js
+++ b/modules/translation/ext.cx.translation.js
@@ -20,6 +20,8 @@
this.$container = $( element );
this.options = $.extend( true, {}, $.fn.cxTranslation.defaults, 
options );
this.language = '';
+   this.$title = null;
+   this.$content = null;
this.init();
}
 
@@ -51,6 +53,8 @@
.addClass( 'cx-column__content' );
 
this.$container.append( $content );
+   this.$title = this.$container.find( '.cx-column__title' );
+   this.$content = this.$container.find( '.cx-column__content' );
};
 
ContentTranslationEditor.prototype.listen = function () {
@@ -58,7 +62,7 @@
};
 
ContentTranslationEditor.prototype.update = function ( data ) {
-   this.$container.find( '.cx-column__content' ).html( data );
+   this.$content.html( data );
mw.hook( 'mw.cx.progress' ).fire( 100 );
};
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2c9bb0ddc2d5451f2f7e0015efe97488742644f0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Minor renaming of event name and a variable name - change (mediawiki...ContentTranslation)

2014-01-17 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Minor renaming of event name and a variable name
..

Minor renaming of event name and a variable name

Change-Id: I5b00976235c50bf0b6776d4fdefe51139d320716
---
M modules/source/ext.cx.source.js
M modules/translation/ext.cx.translation.js
2 files changed, 6 insertions(+), 6 deletions(-)


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

diff --git a/modules/source/ext.cx.source.js b/modules/source/ext.cx.source.js
index b68779a..6d39846 100644
--- a/modules/source/ext.cx.source.js
+++ b/modules/source/ext.cx.source.js
@@ -68,7 +68,7 @@
 
ContentTranslationSource.prototype.listen = function () {
this.$container.find( '.cx-column__content' ).on( 'click', 
function () {
-   mw.hook( 'mw.cx.addContent' ).fire( $( this ).html() );
+   mw.hook( 'mw.cx.translation.add' ).fire( $( this 
).html() );
} );
};
 
diff --git a/modules/translation/ext.cx.translation.js 
b/modules/translation/ext.cx.translation.js
index 18c65cf..07946f1 100644
--- a/modules/translation/ext.cx.translation.js
+++ b/modules/translation/ext.cx.translation.js
@@ -19,12 +19,12 @@
function ContentTranslationEditor( element, options ) {
this.$container = $( element );
this.options = $.extend( true, {}, $.fn.cxTranslation.defaults, 
options );
-   this.lang = '';
+   this.language = '';
this.init();
}
 
ContentTranslationEditor.prototype.init = function () {
-   this.lang = new mw.Uri().query.lang || '';
+   this.language = new mw.Uri().query.lang || '';
this.render();
this.listen();
};
@@ -34,8 +34,8 @@
 
if ( this.lang ) {
this.$container.prop( {
-   lang: this.lang,
-   dir: $.uls.data.getDir( this.lang )
+   lang: this.language,
+   dir: $.uls.data.getDir( this.language )
} );
}
 
@@ -54,7 +54,7 @@
};
 
ContentTranslationEditor.prototype.listen = function () {
-   mw.hook( 'mw.cx.addContent' ).add( $.proxy( this.update, this ) 
);
+   mw.hook(  'mw.cx.translation.add' ).add( $.proxy( this.update, 
this ) );
};
 
ContentTranslationEditor.prototype.update = function ( data ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5b00976235c50bf0b6776d4fdefe51139d320716
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] For IE, do not use salt for tofu detection - change (mediawiki...UniversalLanguageSelector)

2014-01-20 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: For IE, do not use salt for tofu detection
..

For IE, do not use salt for tofu detection

Adding salt wont work for IE since it uses a tofu with small width
for unassigned code points. From tests, Algortithm without salt
should be enough for IE.

Change-Id: If39e6c49d272fa67f60c19f1af64f1fb71856bcd
---
M resources/js/ext.uls.webfonts.js
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/34/108534/1

diff --git a/resources/js/ext.uls.webfonts.js b/resources/js/ext.uls.webfonts.js
index 30a41ec..d2a14f4 100644
--- a/resources/js/ext.uls.webfonts.js
+++ b/resources/js/ext.uls.webfonts.js
@@ -73,7 +73,10 @@
length = Math.min( 4, text.length ),
detected = false;
 
-   text = tofuSalt + text;
+   if ( $.client.test( { msie: false } ) ) {
+   // IE shows a different tofu for unassigned code points!
+   text = tofuSalt + text;
+   }
$fixture = $( '' )
.css( {
fontSize: '72px',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If39e6c49d272fa67f60c19f1af64f1fb71856bcd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Minor whitespace clean up - change (mediawiki...ContentTranslation)

2014-01-21 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Minor whitespace clean up
..

Minor whitespace clean up

Change-Id: I3da072aedcdb6996b3c5b69c7c45a3f232521c62
---
M specials/SpecialContentTranslation.php
1 file changed, 2 insertions(+), 3 deletions(-)


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

diff --git a/specials/SpecialContentTranslation.php 
b/specials/SpecialContentTranslation.php
index 4425981..fd619f8 100644
--- a/specials/SpecialContentTranslation.php
+++ b/specials/SpecialContentTranslation.php
@@ -27,9 +27,8 @@
$user = $this->getUser();
 
if ( !($user->isLoggedIn() ) ) {
-   $out->addHTML( $this->msg('cx-special-login-error'));
-   }
-   else {
+   $out->addHTML( $this->msg( 'cx-special-login-error' ) );
+   } else {
$out->addModules( 'ext.cx.base' );
$this->setHeaders();
$out->setArticleBodyOnly( true );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3da072aedcdb6996b3c5b69c7c45a3f232521c62
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Source: Subheading styling - change (mediawiki...ContentTranslation)

2014-01-22 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Source: Subheading styling
..

Source: Subheading styling

Change-Id: I01be35eb46a789d3b9e85e9671d8d9481369e003
---
M Resources.php
M modules/source/ext.cx.source.js
A modules/source/styles/ext.cx.source.less
3 files changed, 22 insertions(+), 1 deletion(-)


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

diff --git a/Resources.php b/Resources.php
index ce99bd5..987fa0c 100644
--- a/Resources.php
+++ b/Resources.php
@@ -48,6 +48,9 @@
 
 $wgResourceModules['ext.cx.source'] = array(
'scripts' => 'source/ext.cx.source.js',
+   'styles' => array(
+   'source/styles/ext.cx.source.less',
+   ),
'dependencies' => array(
'jquery.uls.data',
'mediawiki.Uri',
diff --git a/modules/source/ext.cx.source.js b/modules/source/ext.cx.source.js
index 617bfe9..fc33b10 100644
--- a/modules/source/ext.cx.source.js
+++ b/modules/source/ext.cx.source.js
@@ -55,7 +55,7 @@
.text( $.uls.data.getAutonym( 
contentLanguage ) ),
$( '' )
.addClass( 
'cx-column__sub-heading__view-page' )
-   .html( ' ' + mw.message(
+   .html( mw.message(
'cx-source-view-page',
mw.util.getUrl( 
this.page )
).parse() )
diff --git a/modules/source/styles/ext.cx.source.less 
b/modules/source/styles/ext.cx.source.less
new file mode 100644
index 000..6589ffd
--- /dev/null
+++ b/modules/source/styles/ext.cx.source.less
@@ -0,0 +1,18 @@
+@import "../../base/styles/grid/agora-grid";
+
+.cx-column--source {
+   .cx-column__sub-heading {
+   .mw-ui-item;
+   .mw-ui-one-whole;
+   padding-bottom: 10px;
+   }
+   .cx-column__language-label {
+   .mw-ui-item;
+   .mw-ui-one-third;
+   }
+   .cx-column__sub-heading__view-page {
+   .mw-ui-item;
+   .mw-ui-one-third;
+   }
+}
+

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I01be35eb46a789d3b9e85e9671d8d9481369e003
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Refactor the css so that embedded images are optimally loaded - change (mediawiki...UniversalLanguageSelector)

2014-01-22 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Refactor the css so that embedded images are optimally loaded
..

Refactor the css so that embedded images are optimally loaded

Change-Id: If19d20fb22afafbf62c355394dcda825a0151ac6
---
M Resources.php
M UniversalLanguageSelector.hooks.php
M resources/css/ext.uls.css
M resources/css/ext.uls.inputsettings.css
M resources/css/ext.uls.languagesettings.css
5 files changed, 59 insertions(+), 115 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/41/109041/1

diff --git a/Resources.php b/Resources.php
index 2b5b70b..42e3799 100644
--- a/Resources.php
+++ b/Resources.php
@@ -248,6 +248,14 @@
'targets' => array( 'desktop', 'mobile' ),
 ) + $resourcePaths;
 
+$wgResourceModules['ext.uls.pt'] = array(
+   'styles' => 'resources/css/ext.uls.pt.css',
+) + $resourcePaths;
+
+$wgResourceModules['ext.uls.interlanguage'] = array(
+   'styles' => 'resources/css/ext.uls.interlanguage.css',
+) + $resourcePaths;
+
 // A module named rangy is defined in VisualExtension with more features of 
rangy.
 // Here we need only the core library. This module is loaded dynamically from
 // client when rangy is undefined. If VE is present rangy will be defined, the 
module
diff --git a/UniversalLanguageSelector.hooks.php 
b/UniversalLanguageSelector.hooks.php
index c53d3af..130d1fe 100644
--- a/UniversalLanguageSelector.hooks.php
+++ b/UniversalLanguageSelector.hooks.php
@@ -44,7 +44,7 @@
 * Hook: BeforePageDisplay
 */
public static function addModules( $out, $skin ) {
-   global $wgULSGeoService, $wgULSEventLogging;
+   global $wgULSPosition, $wgULSGeoService, $wgULSEventLogging;
 
// Load the style for users without JS, to hide the useless 
links
$out->addModuleStyles( 'ext.uls.nojs' );
@@ -70,6 +70,12 @@
$out->addModules( 'ext.uls.interface' );
}
 
+   if ( $wgULSPosition === 'personal' ) {
+   $out->addModules( 'ext.uls.pt' );
+   } else {
+   $out->addModules( 'ext.uls.interlanguage' );
+   }
+
return true;
}
 
diff --git a/resources/css/ext.uls.css b/resources/css/ext.uls.css
index 206d2f7..f831c0b 100644
--- a/resources/css/ext.uls.css
+++ b/resources/css/ext.uls.css
@@ -1,77 +1,3 @@
-/*
- * The trigger can be placed in the personal toolbar near the username
- * or near the interlanguage links.
- */
-
-/*
- * A hack to load the icon before the rest of the module is lazy-loaded.
- * Copied from jquuery.uls.css with the path changed.
- */
-.uls-trigger {
-   /* @embed */
-   background: transparent 
url('../../lib/jquery.uls/images/icon-language.png') no-repeat scroll left 
center;
-   /* @embed */
-   background-image: -webkit-linear-gradient(transparent, transparent), 
url('../../lib/jquery.uls/images/icon-language.svg');
-   /* @embed */
-   background-image: -moz-linear-gradient(transparent, transparent), 
url('../../lib/jquery.uls/images/icon-language.svg');
-   /* @embed */
-   background-image: linear-gradient(transparent, transparent), 
url('../../lib/jquery.uls/images/icon-language.svg');
-   padding-left: 30px;
-}
-
-#pt-uls a.uls-trigger {
-   padding-left: 30px;
-   /* Fix alignment in vector: https://bugzilla.wikimedia.org/59239 */
-   line-height: 1;
-}
-
-#p-lang .uls-settings-trigger {
-   /* @embed */
-   background: transparent url('../images/cog-sprite.png') no-repeat right 
top;
-   /* @embed */
-   background-image: -webkit-linear-gradient(transparent, transparent), 
url('../images/cog-sprite.svg');
-   /* @embed */
-   background-image: -moz-linear-gradient(transparent, transparent), 
url('../images/cog-sprite.svg');
-   /* @embed */
-   background-image: linear-gradient(transparent, transparent), 
url('../images/cog-sprite.svg');
-   height: 16px;
-   width: 14px;
-   float: right;
-   cursor: pointer;
-}
-
-.skin-vector #p-lang .uls-settings-trigger {
-   /* Put it in the middle of the first row of the section title */
-   margin-top: 3px;
-}
-
-#p-lang .uls-settings-trigger:hover {
-   background-position: right -16px;
-}
-
-/* Opera for some inexplicable reason confuses right and left padding with */
-/* RTL text direction here (bug 45142). x:-o-prefocus won't match anything, */
-/* but will make other browsers ignore this rule. */
-x:-o-prefocus, body.rtl li#pt-uls {
-   /* @noflip */
-   direction: ltr;
-}
-
-#settings-block {
-   border-top: 1px solid #C9C9C9;
-   background: #f8f8f8;
-   background: -webkit-gradient(linear, left top, left bottom, 
from(#FBFBFB), to(#F0F0F0));
-   background: -webkit-lin

[MediaWiki-commits] [Gerrit] Remove the license string from the font repository - change (mediawiki...UniversalLanguageSelector)

2014-01-24 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Remove the license string from the font repository
..

Remove the license string from the font repository

Saves 2KB

Change-Id: Ifc4add09a00b1906fad60185f95d0691915d9c94
---
M data/fontrepo/scripts/compile.php
M resources/js/ext.uls.webfonts.repository.js
2 files changed, 1 insertion(+), 7 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/41/109441/1

diff --git a/data/fontrepo/scripts/compile.php 
b/data/fontrepo/scripts/compile.php
index b480cdf..1c6986c 100644
--- a/data/fontrepo/scripts/compile.php
+++ b/data/fontrepo/scripts/compile.php
@@ -14,7 +14,6 @@
$conf = parse_ini_file( $inifile, true );
$languages = array();
$version = null;
-   $license = null;
foreach ( $conf as $fontname => $font ) {
 
if ( isset( $font['languages'] ) ) {
@@ -36,13 +35,8 @@
if ( isset( $font['version'] ) ) {
$version = $font['version'];
}
-   if ( isset( $font['license'] ) ) {
-   $license = $font['license'];
-   }
-
$list['fonts'][$fontname] = array(
'version' => $version,
-   'license' => $license,
);
 
if ( isset( $font['fontweight'] ) ) {
diff --git a/resources/js/ext.uls.webfonts.repository.js 
b/resources/js/ext.uls.webfonts.repository.js
index a91a3f1..33974e0 100644
--- a/resources/js/ext.uls.webfonts.repository.js
+++ b/resources/js/ext.uls.webfonts.repository.js
@@ -1,5 +1,5 @@
 // Do not edit! This file is generated from data/fontrepo by 
data/fontrepo/scripts/compile.php
 ( function ( $ ) {
$.webfonts = $.webfonts || {};
-   $.webfonts.repository = 
{"base":"..\/data\/fontrepo\/fonts\/","languages":{"adx":["Jomolhari"],"af":["system","OpenDyslexic"],"ahr":["Lohit
 
Marathi"],"akk":["Akkadian"],"am":["AbyssinicaSIL"],"ang":["system","Junicode"],"ar":["system","Amiri"],"arb":["system","Amiri"],"arc":["Estrangelo
 Edessa","East Syriac Adiabene","SertoUrhoy"],"as":["system","Lohit 
Assamese"],"bbc":["system","Pangururan"],"bh":["Lohit 
Devanagari"],"bho":["Lohit 
Devanagari"],"bk":["system","OpenDyslexic"],"bn":["Siyam Rupali","Lohit 
Bengali"],"bo":["Jomolhari"],"bod":["Jomolhari"],"bpy":["Siyam Rupali","Lohit 
Bengali"],"btk":["system","Pangururan"],"bug":["Saweri"],"ca":["system","OpenDyslexic"],"cdo":["system","CharisSIL"],"ckb":["system","Lateef","Scheherazade","Amiri"],"cr":["OskiEast"],"cy":["system","OpenDyslexic"],"da":["system","OpenDyslexic"],"de":["system","OpenDyslexic"],"dre":["Jomolhari"],"dv":["FreeFont-Thaana"],"dz":["Jomolhari"],"en":["system","OpenDyslexic"],"es":["system","OpenDyslexic"],"et":["system","OpenDyslexic"],"fa":["system","Iranian
 
Sans","Lateef","Nazli","Scheherazade","Amiri"],"fi":["system","OpenDyslexic"],"fo":["system","OpenDyslexic"],"fr":["system","OpenDyslexic"],"fy":["system","OpenDyslexic"],"ga":["system","OpenDyslexic"],"gd":["system","OpenDyslexic"],"gez":["AbyssinicaSIL"],"gl":["system","OpenDyslexic"],"goe":["Jomolhari"],"gom":["Lohit
 Devanagari"],"grc":["system","GentiumPlus"],"gu":["Lohit 
Gujarati"],"hbo":["Taamey Frank CLM","Alef"],"he":["system","Alef","Miriam 
CLM","Taamey Frank CLM"],"hi":["Lohit 
Devanagari"],"hu":["system","OpenDyslexic"],"hut":["Jomolhari"],"id":["system","OpenDyslexic"],"ii":["Nuosu
 
SIL"],"is":["system","OpenDyslexic"],"it":["system","OpenDyslexic"],"iu":["system","OskiEast"],"jv":["system","Tuladha
 Jejeg"],"jv-java":["Tuladha 
Jejeg"],"kbg":["Jomolhari"],"khg":["Jomolhari"],"km":["KhmerOSbattambang","Hanuman","KhmerOS","Nokora
 Regular","Suwannaphum"],"kn":["Lohit Kannada","Gubbi"],"kok":["Lohit 
Devanagari"],"kte":["Jomolhari"],"lb":["system","OpenDyslexic"],"lbj":["Jomolhari"],"lhm":["Jomolhari"],"li":["system","OpenDyslexic"],"lo":["Phetsarath"],"loy":["Jomolhari"],"luk":["Jomolhari"],"lya":["Jomolhari"],"mai":["Lohit
 
Devanagari"],"mak":["Saweri"],"mi":["system","OpenDyslexic"],"ml":["system","AnjaliOldLipi","Meera"],"mr":["Lohit
 
Marathi"],"ms":["system","OpenDyslexic"],"muk":["Jomolhari"],"mul":["system","Autonym"],"my":["TharLon","Myanmar3","Padauk"],"nan":["system","CharisSIL","Doulos
 SIL"],"nb":["system","OpenDyslexic"],"ne":["Lohit 
Nepali","Madan"],"nl":["system","OpenDyslexic"],"oc":["system","OpenDyslexic"],"ola":["Jomolhari"],"or":["Lohit
 Oriya","Utkal"],"otb":["Jomolhari"],"pa":["Lohit 
Punjabi","Saab"],"pal":["Shapour"],"peo":["Xerxes"],"pl":["system","OpenDyslexic"],"pt":["system","OpenDyslexic"],"sa":["Lohit
 
Devanagari"],"saz":["Pagul"],"si":["system","lklug"],"sq":["system","OpenDyslexic"],"sux":["Akkadian"],"sv":["system","OpenDyslexic"],"sw":["system","OpenDyslexic"],"syc":["Estrangelo
 Edessa","East Syriac Adiabene","S

[MediaWiki-commits] [Gerrit] Update jquery.uls from upstream - change (mediawiki...UniversalLanguageSelector)

2013-07-04 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Update jquery.uls from upstream
..

Update jquery.uls from upstream

Performance improvements by matmarex

Change-Id: Ie89bd56702dec231a8c27f9cf8eeb7bbffe9b251
---
M lib/jquery.uls/i18n/ka.json
M lib/jquery.uls/src/jquery.uls.core.js
M lib/jquery.uls/src/jquery.uls.lcd.js
M lib/jquery.uls/src/jquery.uls.regionfilter.js
4 files changed, 27 insertions(+), 48 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/73/71973/1

diff --git a/lib/jquery.uls/i18n/ka.json b/lib/jquery.uls/i18n/ka.json
index 530b5e5..b42f526 100644
--- a/lib/jquery.uls/i18n/ka.json
+++ b/lib/jquery.uls/i18n/ka.json
@@ -4,13 +4,18 @@
 "David1010"
 ]
 },
+"uls-select-language": "\u10d0\u10d8\u10e0\u10e9\u10d8\u10d4\u10d7 
\u10d4\u10dc\u10d0",
 "uls-region-WW": "\u10db\u10e1\u10dd\u10e4\u10da\u10d8\u10dd",
+"uls-region-SP": 
"\u10e1\u10de\u10d4\u10ea\u10d8\u10d0\u10da\u10e3\u10e0\u10d8",
 "uls-region-AM": "\u10d0\u10db\u10d4\u10e0\u10d8\u10d9\u10d0",
 "uls-region-AF": "\u10d0\u10e4\u10e0\u10d8\u10d9\u10d0",
 "uls-region-EU": "\u10d4\u10d5\u10e0\u10dd\u10de\u10d0",
 "uls-region-AS": "\u10d0\u10d6\u10d8\u10d0",
 "uls-region-ME": "\u10d0\u10ee\u10da\u10dd 
\u10d0\u10e6\u10db\u10dd\u10e1\u10d0\u10d5\u10da\u10d4\u10d7\u10d8",
 "uls-region-PA": "\u10dd\u10d9\u10d4\u10d0\u10dc\u10d4\u10d7\u10d8",
+"uls-no-results-found": "\u10e8\u10d4\u10d3\u10d4\u10d2\u10d8 
\u10d5\u10d4\u10e0 \u10db\u10dd\u10d8\u10eb\u10d4\u10d1\u10dc\u10d0",
 "uls-common-languages": "\u10e1\u10d0\u10d4\u10e0\u10d7\u10dd 
\u10d4\u10dc\u10d4\u10d1\u10d8",
+"uls-no-results-suggestion-title": "\u10d8\u10e5\u10dc\u10d4\u10d1 
\u10d7\u10e5\u10d5\u10d4\u10dc \u10d0\u10db 
\u10d4\u10dc\u10d4\u10d1\u10db\u10d0 
\u10d3\u10d0\u10d2\u10d0\u10d8\u10dc\u10e2\u10d4\u10e0\u10d4\u10e1\u10dd\u10d7:",
+"uls-search-help": "\u10eb\u10d8\u10d4\u10d1\u10d0 
\u10e8\u10d4\u10e1\u10d0\u10eb\u10da\u10d4\u10d1\u10d4\u10da\u10d8\u10d0 
\u10d4\u10dc\u10d8\u10e1 \u10e1\u10d0\u10ee\u10d4\u10da\u10d8\u10d7 
\u10d0\u10dc 
\u10d3\u10d0\u10db\u10ec\u10d4\u10e0\u10da\u10dd\u10d1\u10d8\u10d7, 
\u10d4\u10dc\u10d8\u10e1 ISO-\u10d9\u10dd\u10d3\u10d8\u10d7 \u10d0\u10dc 
\u10e0\u10d4\u10d2\u10d8\u10dd\u10dc\u10d8\u10e1 
\u10db\u10d8\u10ee\u10d4\u10d3\u10d5\u10d8\u10d7:",
 "uls-search-placeholder": "\u10d4\u10dc\u10d8\u10e1 
\u10db\u10dd\u10eb\u10d4\u10d1\u10dc\u10d0"
 }
\ No newline at end of file
diff --git a/lib/jquery.uls/src/jquery.uls.core.js 
b/lib/jquery.uls/src/jquery.uls.core.js
index 0d3cfd0..cac2b8d 100644
--- a/lib/jquery.uls/src/jquery.uls.core.js
+++ b/lib/jquery.uls/src/jquery.uls.core.js
@@ -201,11 +201,7 @@
defaultSearch: function () {
this.$resultsView.lcd( 'empty' );
 
-   if ( this.options.lazyload ) {
-   this.$regionFilters.first().regionselector( 
'show' );
-   } else {
-   this.$regionFilters.regionselector( 'show' );
-   }
+   this.$regionFilters.regionselector( 'show' );
},
 
/**
@@ -269,7 +265,6 @@
languages: uls.languages,
quickList: uls.options.quickList,
clickhandler: $.proxy( uls.select, uls ),
-   lazyload: uls.options.lazyload,
source: uls.$languageFilter,
showRegions: uls.options.showRegions
} ).data( 'lcd' );
@@ -412,7 +407,6 @@
searchAPI: null, // Language search API
languages: $.uls.data.getAutonyms(), // Languages to be used 
for ULS, default is all languages
quickList: null, // Array of language codes or function that 
returns such
-   lazyload: true, // Lazy load the language list when scrolled.
compact: false, // Show ULS in compact mode
showRegions: ['WW', 'AM', 'EU', 'ME', 'AF', 'AS', 'PA']
};
diff --git a/lib/jquery.uls/src/jquery.uls.lcd.js 
b/lib/jquery.uls/src/jquery.uls.lcd.js
index 927f419..87f79c2 100644
--- a/lib/jquery.uls/src/jquery.uls.lcd.js
+++ b/lib/jquery.uls/src/jquery.uls.lcd.js
@@ -287,11 +287,6 @@
scrollTop = 
$ulsLanguageList.position().top,
scrollBottom = 
$ulsLanguageList.height();
 
-   if ( lcd.options.lazyload && 
lcd.options.source.val() === '' ) {
-   if ( this.offsetHeight + this.scrollTop 
>= this.scrollHeight / 2 ) {
-   lcd.$element.tri

[MediaWiki-commits] [Gerrit] Use single entry point mw.uls.init for all ULS ui initializa... - change (mediawiki...UniversalLanguageSelector)

2013-07-04 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Use single entry point mw.uls.init for all ULS ui initialization
..

Use single entry point mw.uls.init for all ULS ui initialization

Change-Id: I485ea27deebb530eb89e4b0935eda01a5276f884
---
M resources/js/ext.uls.ime.js
M resources/js/ext.uls.init.js
M resources/js/ext.uls.interface.js
M resources/js/ext.uls.webfonts.js
4 files changed, 36 insertions(+), 29 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/89/71989/1

diff --git a/resources/js/ext.uls.ime.js b/resources/js/ext.uls.ime.js
index 1d26010..d3da527 100644
--- a/resources/js/ext.uls.ime.js
+++ b/resources/js/ext.uls.ime.js
@@ -203,17 +203,14 @@
};
 
$( document ).ready( function () {
-   if ( !mw.uls.isBrowserSupported() ) {
-   return;
-   }
+   mw.uls.init( function () {
+   // Load the ime preferences
+   $.ime.preferences.load();
 
-   // Load the ime preferences
-   $.ime.preferences.load();
-
-   if ( $.ime.preferences.isEnabled() ) {
-   mw.ime.setup();
-   }
-
+   if ( $.ime.preferences.isEnabled() ) {
+   mw.ime.setup();
+   }
+   } );
} );
 
function imeNotification () {
diff --git a/resources/js/ext.uls.init.js b/resources/js/ext.uls.init.js
index f35dfee..dee92b8 100644
--- a/resources/js/ext.uls.init.js
+++ b/resources/js/ext.uls.init.js
@@ -31,7 +31,8 @@
this.$languageFilter.addClass( 'noime' );
};
 
-   var currentLang = mw.config.get( 'wgUserLanguage' );
+   var initialized = false,
+   currentLang = mw.config.get( 'wgUserLanguage' );
mw.uls = mw.uls || {};
mw.uls.previousLanguagesCookie = 'uls-previous-languages';
/**
@@ -111,7 +112,7 @@
 * Browse support policy: 
http://www.mediawiki.org/wiki/Browser_support#Grade_A
 * @return boolean
 */
-   mw.uls.isBrowserSupported = function () {
+   function isBrowserSupported() {
// Blacklist Grade B browsers IE 6, 7 and IE60-IE79
return !/MSIE [67]/i.test( navigator.userAgent );
};
@@ -159,8 +160,14 @@
.load( jsonLoader + currentLang, currentLang );
}
 
-   $( document ).ready( function () {
-   if ( !mw.uls.isBrowserSupported() ) {
+   mw.uls.init = function( callback ) {
+   callback = callback || $.noop;
+
+   if ( initialized ) {
+   callback.call( this, false );
+   return;
+   }
+   if ( !isBrowserSupported() ) {
$( '#pt-uls' ).hide();
return;
}
@@ -177,5 +184,11 @@
 
// JavaScript side i18n initialization
i18nInit();
+   initialized = true;
+   callback.call( this, true );
+   }
+
+   $( document ).ready( function () {
+   mw.uls.init();
} );
 }( jQuery, mediaWiki ) );
diff --git a/resources/js/ext.uls.interface.js 
b/resources/js/ext.uls.interface.js
index e243b24..3212d69 100644
--- a/resources/js/ext.uls.interface.js
+++ b/resources/js/ext.uls.interface.js
@@ -223,6 +223,7 @@
}
 
$( document ).ready( function () {
+   mw.uls.init( function () {
var $ulsTrigger = $( '.uls-trigger' ),
$ulsSettingsTrigger,
$pLang,
@@ -231,10 +232,6 @@
anonMode = ( mw.user.isAnon() &&
!mw.config.get( 'wgULSAnonCanChangeLanguage' ) 
),
ulsPosition = mw.config.get( 'wgULSPosition' );
-
-   if ( !mw.uls.isBrowserSupported() ) {
-   return;
-   }
 
if ( ulsPosition === 'interlanguage' ) {
// The interlanguage links section
@@ -325,4 +322,5 @@
 
showULSTooltip();
} );
+   } );
 }( jQuery, mediaWiki ) );
diff --git a/resources/js/ext.uls.webfonts.js b/resources/js/ext.uls.webfonts.js
index 4b11ae8..804f0fa 100644
--- a/resources/js/ext.uls.webfonts.js
+++ b/resources/js/ext.uls.webfonts.js
@@ -81,17 +81,16 @@
};
 
$( document ).ready( function () {
-   if ( !mw.uls.isBrowserSupported() ) {
-   return;
-   }
-   // MediaWiki specific overrides for jquery.webfonts
-   $.extend( $.fn.webfonts.defaults, {
-   repository: mediawikiFontRepository,
-   fontStack: new Array( $( 'b

[MediaWiki-commits] [Gerrit] jquery.i18n messagestore for ULS - change (mediawiki...UniversalLanguageSelector)

2013-07-04 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: jquery.i18n messagestore for ULS
..

jquery.i18n messagestore for ULS

Change-Id: Iddef0805abbf9b4ff0e606fc311c57e9dfa7107d
---
M resources/js/ext.uls.displaysettings.js
M resources/js/ext.uls.init.js
2 files changed, 58 insertions(+), 18 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/90/71990/1

diff --git a/resources/js/ext.uls.displaysettings.js 
b/resources/js/ext.uls.displaysettings.js
index 7de1345..a639288 100644
--- a/resources/js/ext.uls.displaysettings.js
+++ b/resources/js/ext.uls.displaysettings.js
@@ -196,6 +196,8 @@
 
function buttonHandler( button ) {
return function () {
+   var i18n;
+
displaySettings.enableApplyButton();
displaySettings.uiLanguage = 
button.data( 'language' ) || displaySettings.uiLanguage;
$( 'div.uls-ui-languages button.button' 
).removeClass( 'down' );
@@ -204,8 +206,11 @@
// set the language for the settings 
panel so that webfonts
// are correctly applied.
displaySettings.$template.attr( 'lang', 
displaySettings.uiLanguage );
-   $.i18n().locale = 
displaySettings.uiLanguage;
-   displaySettings.i18n();
+   i18n = $.i18n();
+   i18n.locale = 
displaySettings.uiLanguage;
+   i18n.messageStore.load( i18n.locale, 
function() {
+   displaySettings.i18n();
+   } ) ;
};
}
 
diff --git a/resources/js/ext.uls.init.js b/resources/js/ext.uls.init.js
index dee92b8..2a1a010 100644
--- a/resources/js/ext.uls.init.js
+++ b/resources/js/ext.uls.init.js
@@ -32,6 +32,7 @@
};
 
var initialized = false,
+   MWMessageStore,
currentLang = mw.config.get( 'wgUserLanguage' );
mw.uls = mw.uls || {};
mw.uls.previousLanguagesCookie = 'uls-previous-languages';
@@ -115,7 +116,7 @@
function isBrowserSupported() {
// Blacklist Grade B browsers IE 6, 7 and IE60-IE79
return !/MSIE [67]/i.test( navigator.userAgent );
-   };
+   }
 
/**
 * Local wrapper for 'mw.eventLog.logEvent' which handles default params
@@ -145,28 +146,57 @@
}
 
/**
-* i18n initialization
+* jquery.i18n message store for MediaWiki
+*
 */
-   function i18nInit() {
-   var jsonLoader = mw.util.wikiScript( 'api' ) + 
'?action=ulslocalization&language=';
+   MWMessageStore = function () {
+   this.messages = {};
+   };
 
-   $.i18n( {
-   locale: currentLang,
-   messageLocationResolver: function ( locale ) {
-   return jsonLoader + locale;
+   MWMessageStore.prototype = {
+   init: function () {},
+   get: function ( locale, messageKey ) {
+   return (  this.isLoaded( locale )
+   && this.messages[locale][messageKey] )
+   || '<' + messageKey + '>';
+   },
+   set: function( locale, messages ) {
+   this.messages[locale] = messages;
+   },
+   isLoaded:function ( locale ) {
+   if ( this.messages[locale] ) {
+   return true;
}
-   } )
-   // Preload i18n for current language.
-   .load( jsonLoader + currentLang, currentLang );
-   }
+   return false;
+   },
+   load: function( locale, callback ) {
+   var store = this,
+   url = mw.util.wikiScript( 'api' ) + 
'?action=ulslocalization&language=';
 
-   mw.uls.init = function( callback ) {
+   callback = callback || $.noop;
+   if ( store.isLoaded( locale ) ) {
+   callback.call( this );
+   return;
+   }
+   $.getJSON( url + locale ).done( function ( data ) {
+   store.set( locale, data);
+   callback.call( store );
+   } ).fail

[MediaWiki-commits] [Gerrit] Make anything with class 'uls-settings-trigger' work like UL... - change (mediawiki...UniversalLanguageSelector)

2013-07-05 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Make anything with class 'uls-settings-trigger' work like ULS 
trigger
..

Make anything with class 'uls-settings-trigger' work like ULS trigger

Usecase:

Reading problems? click [here]. That [here] can be a ULS trigger to open
language settings.

Change-Id: I1561f8b782037bfdb418f33097fc8b4c519ef393
---
M resources/js/ext.uls.interface.js
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/77/72077/1

diff --git a/resources/js/ext.uls.interface.js 
b/resources/js/ext.uls.interface.js
index 4d69347..6e41511 100644
--- a/resources/js/ext.uls.interface.js
+++ b/resources/js/ext.uls.interface.js
@@ -242,7 +242,7 @@
.attr( 'title', $.i18n( 
'ext-uls-language-settings-title' ) );
// Append ULS cog to languages section. But make sure 
it is visible.
$pLang.show().prepend( $ulsSettingsTrigger );
-
+   $ulsSettingsTrigger = $( '.uls-settings-trigger' );
// Remove the dummy link that was added to make sure 
that the section appears
$pLang.find( '.uls-p-lang-dummy' ).remove();
 
@@ -286,8 +286,8 @@
var topRowHeight, caretHeight, 
caretWidth,
$caretBefore = $( '' 
).addClass( 'caret-before' ),
$caretAfter = $( '' 
).addClass( 'caret-after' ),
-   ulsTriggerWidth = 
$ulsSettingsTrigger.width(),
-   ulsTriggerOffset = 
$ulsSettingsTrigger.offset();
+   ulsTriggerWidth = 
this.$element.width(),
+   ulsTriggerOffset = 
this.$element.offset();
 
this.$window.addClass( 'callout' );
this.$window.prepend( $caretBefore, 
$caretAfter );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1561f8b782037bfdb418f33097fc8b4c519ef393
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Apply webfonts to the IME selector too - change (mediawiki...UniversalLanguageSelector)

2013-07-05 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Apply webfonts to the IME selector too
..

Apply webfonts to the IME selector too

It get added to DOM after DOM is ready, and does not inherit styles
(by design)

Change-Id: I45a982b5c1c2a39718f38e77a33b79f89e460474
---
M resources/js/ext.uls.ime.js
M resources/js/ext.uls.webfonts.js
2 files changed, 4 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/87/72087/1

diff --git a/resources/js/ext.uls.ime.js b/resources/js/ext.uls.ime.js
index d3da527..11d2530 100644
--- a/resources/js/ext.uls.ime.js
+++ b/resources/js/ext.uls.ime.js
@@ -148,6 +148,8 @@
e.stopPropagation();
} );
 
+   // apply fonts to this
+   imeselector.$menu.webfonts();
return $( '' )
.addClass( 'uls-ime-menu-settings-item' )
.append( $disableInputToolsLink, $moreSettingsLink );
diff --git a/resources/js/ext.uls.webfonts.js b/resources/js/ext.uls.webfonts.js
index 804f0fa..0c524a7 100644
--- a/resources/js/ext.uls.webfonts.js
+++ b/resources/js/ext.uls.webfonts.js
@@ -52,7 +52,7 @@
 
mw.webfonts.setup = function () {
// Initialize webfonts
-   $( 'body' ).webfonts( {
+   $.fn.webfonts.defaults = $.extend( $.fn.webfonts.defaults, {
fontSelector: function ( repository, language ) {
var font;
 
@@ -78,6 +78,7 @@
return $.fn.webfonts.defaults.exclude;
}() )
} );
+   $( 'body' ).webfonts();
};
 
$( document ).ready( function () {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I45a982b5c1c2a39718f38e77a33b79f89e460474
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Update jquery.ime from upstream - change (mediawiki...UniversalLanguageSelector)

2013-07-05 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Update jquery.ime from upstream
..

Update jquery.ime from upstream

Bug: 50790
Change-Id: I3755581136cca9958e31b20694c4285c14646c38
---
M lib/jquery.ime/jquery.ime.js
1 file changed, 26 insertions(+), 4 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/93/72093/1

diff --git a/lib/jquery.ime/jquery.ime.js b/lib/jquery.ime/jquery.ime.js
index f050bdf..802191b 100644
--- a/lib/jquery.ime/jquery.ime.js
+++ b/lib/jquery.ime/jquery.ime.js
@@ -1,4 +1,4 @@
-/*! jquery.ime - v0.1.0+20130626
+/*! jquery.ime - v0.1.0+20130705
 * https://github.com/wikimedia/jquery.ime
 * Copyright (c) 2013 Santhosh Thottingal; Licensed GPL, MIT */
 ( function ( $ ) {
@@ -668,6 +668,7 @@
keydown: function ( e ) {
var ime = $( e.target ).data( 'ime' ),
firstInputmethod,
+   previousInputMethods,
languageCode;
 
this.focus(); // shows the trigger in case it is hidden
@@ -683,9 +684,15 @@
this.selectLanguage( 
languageCode );
if ( !ime.isActive() && 
$.ime.languages[languageCode] ) {
// Even after pressing 
toggle shortcut again, it is still disabled
-   // Provide the default 
input method in this case.
-   firstInputmethod = 
$.ime.languages[languageCode].inputmethods[0];
-   this.selectIM( 
firstInputmethod );
+   // Check if there is a 
previously used input method.
+   previousInputMethods = 
$.ime.preferences.getPreviousInputMethods();
+   if ( 
previousInputMethods[0] ) {
+   this.selectIM( 
previousInputMethods[0] );
+   } else {
+   // Provide the 
default input method in this case.
+   
firstInputmethod = $.ime.languages[languageCode].inputmethods[0];
+   this.selectIM( 
firstInputmethod );
+   }
}
}
}
@@ -1091,6 +1098,7 @@
isDirty: false,
language : null,
previousLanguages: [], // array of previous languages
+   previousInputMethods: [], // array of previous 
inputmethods
imes: {
'en': 'system'
}
@@ -,6 +1119,7 @@
// Add to the previous languages, but avoid duplicates.
if ( $.inArray( language, 
this.registry.previousLanguages ) === -1 ) {
this.registry.previousLanguages.push( language 
);
+   this.registry.previousLanguages = 
this.registry.previousLanguages.slice( 0, 5 );
}
},
 
@@ -1126,6 +1135,10 @@
return this.registry.previousLanguages;
},
 
+   getPreviousInputMethods: function () {
+   return this.registry.previousInputMethods;
+   },
+
// Set the given IM as the last used for the language
setIM: function ( inputMethod ) {
if ( !this.registry.imes ) {
@@ -1139,6 +1152,15 @@
 
this.registry.imes[this.getLanguage()] = inputMethod;
this.registry.isDirty = true;
+   if ( !this.registry.previousInputMethods ) {
+   this.registry.previousInputMethods = [];
+   }
+
+   // Add to the previous languages, but avoid duplicates.
+   if ( $.inArray( inputMethod, 
this.registry.previousInputMethods ) === -1 ) {
+   this.registry.previousInputMethods.push( 
inputMethod );
+   this.registry.previousInputMethods = 
this.registry.previousInputMethods.slice( 0, 5 );
+   }
},
 
// Return the last used or the default IM f

[MediaWiki-commits] [Gerrit] Documentation for mw.uls.init - change (mediawiki...UniversalLanguageSelector)

2013-07-07 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Documentation for mw.uls.init
..

Documentation for mw.uls.init

Bug: 50858
Change-Id: Iada465a8228955bf24f7a4628bf2288b3fe0c0ac
---
M resources/js/ext.uls.init.js
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/59/72359/1

diff --git a/resources/js/ext.uls.init.js b/resources/js/ext.uls.init.js
index dc542a3..8462401 100644
--- a/resources/js/ext.uls.init.js
+++ b/resources/js/ext.uls.init.js
@@ -221,6 +221,11 @@
}
};
 
+   /**
+* Initialize ULS front-end and its i18n.
+*
+* @param {Function} callback callback function to be called after 
initialization.
+*/
mw.uls.init = function ( callback ) {
var messageStore = new MWMessageStore();
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iada465a8228955bf24f7a4628bf2288b3fe0c0ac
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Update jquery.ime from upstream - change (mediawiki...UniversalLanguageSelector)

2013-07-08 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Update jquery.ime from upstream
..

Update jquery.ime from upstream

Change-Id: I37d3f1e6b0ebff3ddfd46b2c155e4f5fe590cb4b
Version: 0.1.0+20130708
---
M lib/jquery.ime/jquery.ime.js
M lib/jquery.ime/rules/mh/mh.js
M lib/jquery.ime/rules/or/or-inscript.js
M lib/jquery.ime/rules/or/or-inscript2.js
M lib/jquery.ime/rules/or/or-phonetic.js
M lib/jquery.ime/rules/or/or-transliteration.js
6 files changed, 54 insertions(+), 34 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/92/72492/1

diff --git a/lib/jquery.ime/jquery.ime.js b/lib/jquery.ime/jquery.ime.js
index 7286fef..9bf7cc8 100644
--- a/lib/jquery.ime/jquery.ime.js
+++ b/lib/jquery.ime/jquery.ime.js
@@ -1,4 +1,4 @@
-/*! jquery.ime - v0.1.0+20130707
+/*! jquery.ime - v0.1.0+20130708
 * https://github.com/wikimedia/jquery.ime
 * Copyright (c) 2013 Santhosh Thottingal; Licensed GPL, MIT */
 ( function ( $ ) {
@@ -486,7 +486,7 @@
 
var selectorTemplate, MutationObserver;
 
-   function IMESelector ( element, options ) {
+   function IMESelector( element, options ) {
this.$element = $( element );
this.options = $.extend( {}, IMESelector.defaults, options );
this.active = false;
@@ -508,20 +508,24 @@
},
 
prepareSelectorMenu: function () {
-
// TODO: In this approach there is a menu for each 
editable area.
// With correct event mapping we can probably reduce it 
to one menu.
this.$imeSetting = $( selectorTemplate );
this.$menu = $( '' );
-   this.$menu.append( imeListTitle() )
-   .append( imeList() )
-   .append( toggleMenuItem() )
-   .append( languageListTitle() );
+   this.$menu.append(
+   imeListTitle(),
+   imeList(),
+   toggleMenuItem(),
+   languageListTitle()
+   );
+
this.prepareLanguageList();
this.$menu.append( this.helpLink() );
+
if ( $.i18n ) {
this.$menu.i18n();
}
+
this.$imeSetting.append( this.$menu );
$( 'body' ).append( this.$imeSetting );
},
@@ -551,7 +555,8 @@
imeselector.$imeSetting.css( 
'opacity', 1 );
imeselector.$imeSetting.css( 
'margin-top', 0 );
} );
-   }, 2500 );
+   }, 2500
+   );
},
 
focus: function () {
@@ -597,6 +602,7 @@
if ( t.hasClass( 'imeselector-toggle' ) ) {
imeselector.toggle();
}
+
return false;
} );
 
@@ -619,22 +625,31 @@
 
imeselector.$menu.on( 'click.ime', 'li', function() {
imeselector.$element.focus();
+
return false;
} );
 
imeselector.$menu.on( 'click.ime', 'li.ime-im', 
function () {
imeselector.selectIM( $( this ).data( 
'ime-inputmethod' ) );
+
return false;
} );
 
imeselector.$menu.on( 'click.ime', 'li.ime-lang', 
function () {
imeselector.selectLanguage( $( this ).attr( 
'lang' ) );
+
return false;
} );
 
imeselector.$menu.on( 'click.ime', 'div.ime-disable', 
function () {
imeselector.disableIM();
+
return false;
+   } );
+
+   // Just make it work as a regular link
+   imeselector.$menu.on( 'click.ime', '.ime-help-link', 
function ( e ) {
+   e.stopPropagation();
} );
 
imeselector.$element.on( 'focus.ime', function ( e ) {
@@ -683,10 +698,12 @@
} else {
languageCode = 
this.decideLanguage();
this.selectLanguage( 
languageCode );
+
   

[MediaWiki-commits] [Gerrit] Update jquery.uls from upstream - change (mediawiki...UniversalLanguageSelector)

2013-07-08 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Update jquery.uls from upstream
..

Update jquery.uls from upstream

Change-Id: Id8ac99b0ae473272a83c083ac9da0fd25919b0a8
---
A lib/jquery.uls/i18n/pa.json
M lib/jquery.uls/src/jquery.uls.core.js
2 files changed, 22 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/94/72494/1

diff --git a/lib/jquery.uls/i18n/pa.json b/lib/jquery.uls/i18n/pa.json
new file mode 100644
index 000..399bbd5
--- /dev/null
+++ b/lib/jquery.uls/i18n/pa.json
@@ -0,0 +1,21 @@
+{
+"@metadata": {
+"authors": [
+"Babanwalia"
+]
+},
+"uls-select-language": "\u0a2d\u0a3e\u0a38\u0a3c\u0a3e 
\u0a1a\u0a41\u0a23\u0a4b",
+"uls-region-WW": 
"\u0a35\u0a3f\u0a38\u0a3c\u0a35\u0a35\u0a3f\u0a06\u0a2a\u0a40",
+"uls-region-SP": "\u0a16\u0a3c\u0a3e\u0a38",
+"uls-region-AM": "\u0a05\u0a2e\u0a30\u0a40\u0a15\u0a3e",
+"uls-region-AF": "\u0a05\u0a2b\u0a3c\u0a30\u0a40\u0a15\u0a3e",
+"uls-region-EU": "\u0a2f\u0a42\u0a30\u0a2a",
+"uls-region-AS": "\u0a0f\u0a38\u0a3c\u0a40\u0a06",
+"uls-region-ME": "\u0a2e\u0a71\u0a27 \u0a2a\u0a42\u0a30\u0a2c",
+"uls-region-PA": "\u0a2a\u0a4d\u0a30\u0a38\u0a3c\u0a3e\u0a02\u0a24",
+"uls-no-results-found": "\u0a15\u0a4b\u0a08 \u0a28\u0a24\u0a40\u0a1c\u0a3e 
\u0a28\u0a39\u0a40\u0a02 \u0a32\u0a71\u0a2d\u0a3e",
+"uls-common-languages": "\u0a2a\u0a4d\u0a30\u0a1a\u0a71\u0a32\u0a24 
\u0a2d\u0a3e\u0a38\u0a3c\u0a3e\u0a35\u0a3e\u0a02",
+"uls-no-results-suggestion-title": 
"\u0a24\u0a41\u0a39\u0a3e\u0a28\u0a42\u0a70 \u0a07\u0a39\u0a28\u0a3e\u0a02 
\u0a35\u0a3f\u0a71\u0a1a \u0a26\u0a3f\u0a32\u0a1a\u0a38\u0a2a\u0a40 
\u0a39\u0a4b \u0a38\u0a15\u0a26\u0a40 \u0a39\u0a4b:",
+"uls-search-help": "\u0a24\u0a41\u0a38\u0a40\u0a02 
\u0a2d\u0a3e\u0a38\u0a3c\u0a3e \u0a26\u0a47 \u0a28\u0a3e\u0a02, 
\u0a32\u0a3f\u0a2a\u0a40 \u0a26\u0a47 \u0a28\u0a3e\u0a02, 
\u0a2d\u0a3e\u0a38\u0a3c\u0a3e \u0a26\u0a47 ISO \u0a15\u0a4b\u0a21 
\u0a30\u0a3e\u0a39\u0a40\u0a02 \u0a16\u0a4b\u0a1c \u0a38\u0a15\u0a26\u0a47 
\u0a39\u0a4b \u0a1c\u0a3e\u0a02 \u0a16\u0a47\u0a24\u0a30 
\u0a2a\u0a71\u0a16\u0a4b\u0a02 \u0a38\u0a2b\u0a3c\u0a47 \u0a2a\u0a32\u0a1f 
\u0a38\u0a15\u0a26\u0a47 \u0a39\u0a4b:",
+"uls-search-placeholder": "\u0a2d\u0a3e\u0a38\u0a3c\u0a3e 
\u0a16\u0a4b\u0a1c"
+}
\ No newline at end of file
diff --git a/lib/jquery.uls/src/jquery.uls.core.js 
b/lib/jquery.uls/src/jquery.uls.core.js
index cac2b8d..244dd77 100644
--- a/lib/jquery.uls/src/jquery.uls.core.js
+++ b/lib/jquery.uls/src/jquery.uls.core.js
@@ -444,7 +444,7 @@
}, 500 );
}
} );
-   }
+   };
 
$.fn.uls.Constructor = ULS;
 } ( jQuery ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id8ac99b0ae473272a83c083ac9da0fd25919b0a8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Handle explicit plural forms in custom convertPlural in lang... - change (mediawiki/core)

2013-12-03 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Handle explicit plural forms in custom convertPlural in 
language classes
..

Handle explicit plural forms in custom convertPlural in language classes

A new protected method looks for explicitly defined forms.
Every overriden language class is required to use this method
unless they don't want to use explicit plural forms.

Includes tests.

Bug: 46422

Redoing old patch I6dc759e3dfb05d6673209ba00da6592a384d5300

Change-Id: I2a9f93567087babb896999f1214d3c56afc67c96
---
M languages/Language.php
M languages/classes/LanguageBe_tarask.php
M languages/classes/LanguageGv.php
M languages/classes/LanguageHr.php
M languages/classes/LanguageKsh.php
M languages/classes/LanguageSr.php
M languages/classes/LanguageSr_ec.php
M languages/classes/LanguageSr_el.php
M languages/classes/LanguageUk.php
M tests/phpunit/languages/LanguageBe_taraskTest.php
M tests/phpunit/languages/LanguageUkTest.php
11 files changed, 76 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/68/98768/1

diff --git a/languages/Language.php b/languages/Language.php
index dc1fc7d..cb5e15d 100644
--- a/languages/Language.php
+++ b/languages/Language.php
@@ -3632,17 +3632,10 @@
 */
function convertPlural( $count, $forms ) {
// Handle explicit n=pluralform cases
-   foreach ( $forms as $index => $form ) {
-   if ( preg_match( '/^\d+=/i', $form ) ) {
-   $pos = strpos( $form, '=' );
-   if ( substr( $form, 0, $pos ) === 
(string)$count ) {
-   return substr( $form, $pos + 1 );
-   }
-   unset( $forms[$index] );
-   }
+   $forms = $this->handleExplicitPluralForms( $count, $forms );
+   if ( is_string( $forms ) ) {
+   return $forms;
}
-
-   $forms = array_values( $forms );
if ( !count( $forms ) ) {
return '';
}
@@ -3653,6 +3646,34 @@
}
 
/**
+* Handles explicit plural forms for Language::convertPlural()
+*
+* In {{PLURAL:$1|0=nothing|one|many}}, 0=nothing will be returned if 
$1 equals zero.
+* If an explicitly defined plural form matches the $count, then
+* string value returned, otherwise array returned for further 
consideration
+* by CLDR rules or overridden convertPlural()
+*
+* @since 1.22
+*
+* @param int $count non-localized number
+* @param array $forms different plural forms
+*
+* @return array|string
+*/
+   protected function handleExplicitPluralForms( $count, array $forms ) {
+   foreach ( $forms as $index => $form ) {
+   if ( preg_match( '/\d+=/i', $form ) ) {
+   $pos = strpos( $form, '=' );
+   if ( substr( $form, 0, $pos ) === (string) 
$count ) {
+   return substr( $form, $pos + 1 );
+   }
+   unset( $forms[$index] );
+   }
+   }
+   return array_values( $forms );
+   }
+
+   /**
 * Checks that convertPlural was given an array and pads it to requested
 * amount of forms by copying the last one.
 *
diff --git a/languages/classes/LanguageBe_tarask.php 
b/languages/classes/LanguageBe_tarask.php
index 6497b50..d3e78fe 100644
--- a/languages/classes/LanguageBe_tarask.php
+++ b/languages/classes/LanguageBe_tarask.php
@@ -46,6 +46,10 @@
 * @return string
 */
function convertPlural( $count, $forms ) {
+   $forms = $this->handleExplicitPluralForms( $count, $forms );
+   if ( is_string( $forms ) ) {
+   return $forms;
+   }
if ( !count( $forms ) ) {
return '';
}
diff --git a/languages/classes/LanguageGv.php b/languages/classes/LanguageGv.php
index ba8a53c..23a2916 100644
--- a/languages/classes/LanguageGv.php
+++ b/languages/classes/LanguageGv.php
@@ -35,6 +35,10 @@
 * @return string
 */
function convertPlural( $count, $forms ) {
+   $forms = $this->handleExplicitPluralForms( $count, $forms );
+   if ( is_string( $forms ) ) {
+   return $forms;
+   }
if ( !count( $forms ) ) {
return '';
}
diff --git a/languages/classes/LanguageHr.php b/languages/classes/LanguageHr.php
index 910bc10..0c65ec7 100644
--- a/languages/classes/Lang

[MediaWiki-commits] [Gerrit] Make explicit plural forms work for Russian - change (mediawiki/core)

2013-12-03 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Make explicit plural forms work for Russian
..

Make explicit plural forms work for Russian

Russian has overridden convertPlural method, that was not
taking care of explicit plural forms.

Follow up: I2a9f93567087babb896999f1214d3c56afc67c96
Bug: 54514

Change-Id: Ia977fa544b1d0e40222c7296b7145dcd6f93ecc2
---
M languages/classes/LanguageRu.php
M tests/phpunit/languages/LanguageRuTest.php
2 files changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/29/99029/1

diff --git a/languages/classes/LanguageRu.php b/languages/classes/LanguageRu.php
index 11b42cf..243a876 100644
--- a/languages/classes/LanguageRu.php
+++ b/languages/classes/LanguageRu.php
@@ -122,6 +122,10 @@
 * @return string
 */
function convertPlural( $count, $forms ) {
+   $forms = $this->handleExplicitPluralForms( $count, $forms );
+   if ( is_string( $forms ) ) {
+   return $forms;
+   }
if ( !count( $forms ) ) {
return '';
}
diff --git a/tests/phpunit/languages/LanguageRuTest.php 
b/tests/phpunit/languages/LanguageRuTest.php
index e938be7..56f8490 100644
--- a/tests/phpunit/languages/LanguageRuTest.php
+++ b/tests/phpunit/languages/LanguageRuTest.php
@@ -18,6 +18,17 @@
}
 
/**
+* Test explicit plural forms - n=FormN forms
+* @covers Language::convertPlural
+*/
+   public function testExplicitPlural() {
+   $forms = array( 'one', 'few', 'many', 'other', '12=dozen' );
+   $this->assertEquals( 'dozen', $this->getLang()->convertPlural( 
12, $forms ) );
+   $forms = array( 'one', 'few', 'many', '100=hundred', 'other', 
'12=dozen' );
+   $this->assertEquals( 'hundred', 
$this->getLang()->convertPlural( 100, $forms ) );
+   }
+
+   /**
 * @dataProvider providePlural
 * @covers Language::getPluralRuleType
 */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia977fa544b1d0e40222c7296b7145dcd6f93ecc2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Search for translators in Special:TranslatorSandbox - change (mediawiki...Translate)

2013-12-04 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Search for translators in Special:TranslatorSandbox
..

Search for translators in Special:TranslatorSandbox

Change-Id: I82b7ad5b7870fe0c0bd98df83ac2beec2e2b7620
---
M resources/js/ext.translate.special.translatesandbox.js
1 file changed, 58 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate 
refs/changes/28/99328/1

diff --git a/resources/js/ext.translate.special.translatesandbox.js 
b/resources/js/ext.translate.special.translatesandbox.js
index 15d6c09..dba1498 100644
--- a/resources/js/ext.translate.special.translatesandbox.js
+++ b/resources/js/ext.translate.special.translatesandbox.js
@@ -10,6 +10,8 @@
 ( function ( $, mw ) {
'use strict';
 
+   var delay;
+
function doApiAction( options ) {
var api = new mw.Api();
 
@@ -323,6 +325,8 @@
window.setTimeout( setPanesHeight, 0 );
$( window ).on( 'resize', setPanesHeight );
 
+   $( '.request-filter-box' ).translatorSearch();
+
// Handle clicks for the 'Select all' checkbox
$selectAll.on( 'click', function () {
var selectedCount;
@@ -442,4 +446,58 @@
// TODO: Make it functional
$( '.language-selector' ).uls();
} );
+
+   function TranslatorSearch ( element ) {
+   this.$search = $( element );
+   this.init();
+   }
+
+   TranslatorSearch.prototype.init = function () {
+   this.$search.on( 'search keyup', $.proxy( this.keyup, this ) );
+   }
+
+   TranslatorSearch.prototype.keyup = function() {
+   var query,
+   translatorSearch = this;
+
+   // Respond to the keypress events after a small timeout to 
avoid freeze when typed fast.
+   delay( function () {
+   query = $.trim( translatorSearch.$search.val() 
).toLowerCase().trim();
+   translatorSearch.filter( query );
+   }, 300 );
+   }
+
+   TranslatorSearch.prototype.filter = function( query ) {
+   var $requests = $( '.request' );
+   $requests.each( function ( index, request ) {
+   var $request = $(request),
+   requestData = $request.data( 'data' );
+
+   if ( query.length ===0
+   || requestData.username.toLowerCase().indexOf( 
query ) === 0
+   ||  requestData.email.toLowerCase().indexOf( 
query ) === 0 ) {
+   $request.removeClass( 'hide' );
+   } else {
+   $request.addClass( 'hide' );
+   }
+   } );
+   }
+
+   $.fn.translatorSearch = function () {
+return this.each( function () {
+if ( !$.data(this,'TranslatorSearch' ) )  {
+$.data(this, 'TranslatorSearch',
+new TranslatorSearch( this ) );
+}
+});
+   }
+
+   delay = ( function () {
+   var timer = 0;
+
+   return function ( callback, milliseconds ) {
+   clearTimeout( timer );
+   timer = setTimeout( callback, milliseconds );
+   };
+   } () );
 }( jQuery, mediaWiki ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I82b7ad5b7870fe0c0bd98df83ac2beec2e2b7620
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Filter translators by language in Special:TranslatorSandbox - change (mediawiki...Translate)

2013-12-04 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Filter translators by language in Special:TranslatorSandbox
..

Filter translators by language in Special:TranslatorSandbox

Change-Id: Ib10bbe25a1cfd4d7f4fa4d71c6ece8798635d166
---
M resources/js/ext.translate.special.translatesandbox.js
1 file changed, 27 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate 
refs/changes/31/99331/1

diff --git a/resources/js/ext.translate.special.translatesandbox.js 
b/resources/js/ext.translate.special.translatesandbox.js
index dba1498..d3425b9 100644
--- a/resources/js/ext.translate.special.translatesandbox.js
+++ b/resources/js/ext.translate.special.translatesandbox.js
@@ -443,10 +443,35 @@
}
 
// Activate language selector
-   // TODO: Make it functional
-   $( '.language-selector' ).uls();
+   $( '.language-selector' ).uls( {
+   onSelect: function ( language ) {
+   $( '.language-selector' ).text( 
$.uls.data.getAutonym( language ) );
+   filterRequestsByLanguage( language );
+   }
+   } );
} );
 
+   /**
+* Filter the requests by language.
+* @param  {string} language Language code
+*/
+   function filterRequestsByLanguage ( language ) {
+   var $requests = $( '.request' );
+   $requests.each( function ( index, request ) {
+   var $request = $(request),
+   requestData = $request.data( 'data' );
+
+   if ( requestData.languagepreferences
+   && requestData.languagepreferences.languages
+   && 
requestData.languagepreferences.languages.indexOf( language ) > -1 ) {
+   // Found language
+   $request.removeClass( 'hide' );
+   } else {
+   $request.addClass( 'hide' );
+   }
+   } );
+   }
+
function TranslatorSearch ( element ) {
this.$search = $( element );
this.init();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib10bbe25a1cfd4d7f4fa4d71c6ece8798635d166
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Sort the translator requests by number of translations and r... - change (mediawiki...Translate)

2013-12-06 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Sort the translator requests by number of translations and 
request data
..

Sort the translator requests by number of translations and request data

Change-Id: I5e4071ed9d11434aaef050e143e5bee935b5453e
---
M specials/SpecialTranslateSandbox.php
1 file changed, 33 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate 
refs/changes/25/99625/1

diff --git a/specials/SpecialTranslateSandbox.php 
b/specials/SpecialTranslateSandbox.php
index c2a8671..da2664d 100644
--- a/specials/SpecialTranslateSandbox.php
+++ b/specials/SpecialTranslateSandbox.php
@@ -14,7 +14,7 @@
  * @ingroup SpecialPage TranslateSpecialPage
  */
 class SpecialTranslateSandbox extends SpecialPage {
-   ///< @param TranslationStashStorage
+   /// < @param TranslationStashStorage
protected $stash;
 
function __construct() {
@@ -53,7 +53,7 @@
foreach ( array( 'Pupu', 'Orava' ) as $prefix ) {
for ( $i = 0; $i < 5; $i++ ) {
$user = TranslateSandbox::addUser( 
"$prefix$i", "$prefix$i...@pupun.kolo",  'porkkana' );
-   for( $j = 0; $j < $i; $j++ ) {
+   for ( $j = 0; $j < $i; $j++ ) {
$title = Title::makeTitle( 
NS_MEDIAWIKI, wfRandomString( 24 ) . '/fi' );
$translation = 'plop';
$stashedTranslation = new 
StashedTranslation( $user, $title, $translation );
@@ -117,14 +117,28 @@
 
protected function makeList() {
$items = array();
-
+   $requests = array();
$users = TranslateSandbox::getUsers();
 
foreach ( $users as $user ) {
-   $items[] = $this->makeRequestItem( $user );
+   $requests[] = array(
+   'username' => $user->getName(),
+   'email' => $user->getEmail(),
+   'registrationdate' => $user->getRegistration(),
+   'translations' => rand( 0, 20 ),// count( 
$this->stash->getTranslations( $user ) ),
+   'languagepreferences' => FormatJson::decode( 
$user->getOption( 'translate-sandbox' ) ),
+   'userid' => $user->getId(),
+   );
}
 
-   $count = count( $items );
+   // Sort the requests based on translations and registration date
+   usort( $requests, array( __CLASS__, 'translatorRequestSort' ) );
+
+   $count = count( $users );
+   foreach ( $requests as $request ) {
+   $items[] = $this->makeRequestItem( $request );
+   }
+
$requestsList = implode( "\n", $items );
 
return << $user->getName(),
-   'email' => $user->getEmail(),
-   'registrationdate' => $user->getRegistration(),
-   'translations' => count( $this->stash->getTranslations( 
$user ) ),
-   'languagepreferences' => FormatJson::decode( 
$user->getOption( 'translate-sandbox' ) ),
-   'userid' => $user->getId(),
-   );
-
+   protected function makeRequestItem( $request ) {
$requestdataEnc = htmlspecialchars( FormatJson::encode( 
$request ) );
-
$nameEnc = htmlspecialchars( $request['username'] );
$emailEnc = htmlspecialchars( $request['email'] );
$countEnc = htmlspecialchars( $request['translations'] );
@@ -182,4 +186,17 @@
 
 HTML;
}
+
+   /// Sorts groups by descending order of translations and registration 
date
+   public static function translatorRequestSort( $a, $b ) {
+   $aTranslations = $a['translations'];
+   $bTranslations = $b['translations'];
+
+   $translations = $bTranslations - $aTranslations;
+
+   if ( $translations === 0 ) {
+  return strcmp ( $a['registrationdate'], 
$b['registrationdate'] );
+   }
+   return $translations;
+   }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5e4071ed9d11434aaef050e143e5bee935b5453e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/l

[MediaWiki-commits] [Gerrit] Script for finding number of characters edited for a given n... - change (mediawiki...Translate)

2013-12-06 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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


Change subject: Script for finding number of characters edited for a given 
number of days
..

Script for finding number of characters edited for a given number of days

Change-Id: I8c46d8776ef1a212ab235ad13b1f525b89c45443
---
A scripts/charactereditstats.php
1 file changed, 127 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate 
refs/changes/33/99633/1

diff --git a/scripts/charactereditstats.php b/scripts/charactereditstats.php
new file mode 100644
index 000..2b4d47f
--- /dev/null
+++ b/scripts/charactereditstats.php
@@ -0,0 +1,127 @@
+mDescription = 'Script to show number of characters 
translated .';
+   $this->addOption(
+   '(optional) Show given number of language codes 
(default: 10)',
+   'top',
+   false, /*required*/
+   true /*has arg*/
+   );
+   $this->addOption(
+   '(optional) Calculate for given number of days 
(default: 30)',
+   'days',
+   false, /*required*/
+   true /*has arg*/
+   );
+   $this->addOption(
+   '(optional) Include bot edits',
+   'bots'
+   );
+   $this->addOption(
+   '(optional) Comma separated list of namespace IDs',
+   'ns',
+   false, /*required*/
+   true /*has arg*/
+   );
+   }
+
+   public function execute() {
+   $hours = (int)$this->getOption( 'days' );
+   $hours = $hours ? $hours * 24 : 30 * 24;
+
+   $top = (int)$this->getOption( 'top' );
+   $top = $top ? $top : 10;
+
+   $bots = $this->hasOption( 'bots' );
+
+   $namespaces = array();
+   if ( $this->hasOption( 'ns' ) ) {
+   $input = explode( ',', $this->getOption( 'ns' ) );
+
+   foreach ( $input as $namespace ) {
+   if ( is_numeric( $namespace ) ) {
+   array_push( $namespaces, $namespace );
+   }
+   }
+   }
+
+   /**
+* Select set of edits to report on
+*/
+   $rows = TranslateUtils::translationChanges( $hours, $bots, 
$namespaces );
+   /**
+* Get counts for edits per language code after filtering out 
edits by FuzzyBot
+*/
+   $codes = array();
+   global $wgTranslateFuzzyBotName;
+   foreach ( $rows as $revId => $_ ) {
+   // Filter out edits by $wgTranslateFuzzyBotName
+   if ( $_->rc_user_text === $wgTranslateFuzzyBotName ) {
+   continue;
+   }
+
+   list( , $code ) = TranslateUtils::figureMessage( 
$_->rc_title );
+
+   if ( !isset( $codes[$code] ) ) {
+   $codes[$code] = 0;
+   }
+
+   $revision = Revision::newFromId( $revId );
+
+   if ( $revision !== null ) {
+   $prevRevision = $revision->getPrevious();
+   if ( $prevRevision === null ) {
+   $diff = $revision->getSize();
+   } else {
+   $diff = $prevRevision->getSize() - 
$revision->getSize();
+   $diff = $diff >= 0 ? $diff : $diff * -1;
+   }
+   $codes[$code] += $diff;
+   }
+   }
+
+   /**
+* Sort counts and report descending up to $top rows.
+*/
+   arsort( $codes );
+   $i = 0;
+   $total = 0;
+   $this->output( "code\tname\tedit\n" );
+   foreach ( $codes as $code => $num ) {
+   if ( $i++ === $top ) {
+   break;
+   }
+   $total += $num;
+   $language = Language::fetchLanguageName( $code );
+   $charRatio = mb_strlen( $language, 'UTF-8' ) / strlen( 
$language );
+   $num =  $num * $charRatio;
+   $this->output( "$code\t$language\t$num\n" );
+   }
+   $this->output( "---\n" );
+   $this->output( "Total\t\t$total\n" );
+   }
+}
+
+$maintClass = 'Chara

  1   2   3   4   5   6   7   8   9   10   >