Alex Monk has uploaded a new change for review.
https://gerrit.wikimedia.org/r/232527
Change subject: Pass number of templates to
visualeditor-dialog-transclusion-contextitem-description
......................................................................
Pass number of templates to
visualeditor-dialog-transclusion-contextitem-description
Bug: T109564
Change-Id: Icdf762b3761227c3fcedefc947ffc512520cff76
---
M modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
M modules/ve-mw/i18n/qqq.json
M modules/ve-mw/ui/contextitems/ve.ui.MWTransclusionContextItem.js
3 files changed, 18 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/27/232527/1
diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
index fd2ac49..2761116 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
@@ -51,9 +51,13 @@
/* Static Methods */
/**
- * @inheritdoc
+ * Get a list of descriptions of template parts in a transclusion node
+ *
+ * @static
+ * @param {ve.dm.Node} node Node model
+ * @return {string[]} List of template part descriptions
*/
-ve.ce.MWTransclusionNode.static.getDescription = function ( model ) {
+ve.ce.MWTransclusionNode.static.getTemplatePartDescriptions = function ( model
) {
var i, len, part,
parts = model.getPartsList(),
words = [];
@@ -65,11 +69,18 @@
}
}
- return words
+ return words;
+}
+
+/**
+ * @inheritdoc
+ */
+ve.ce.MWTransclusionNode.static.getDescription = function ( model ) {
+ return this.getTemplatePartDescriptions( model )
.map( function ( template ) {
var title = mw.Title.newFromText( template,
mw.config.get( 'wgNamespaceIds' ).template );
if ( title ) {
- return title.getRelativeText( 10 );
+ return title.getRelativeText( mw.config.get(
'wgNamespaceIds' ).template );
} else {
return template;
}
diff --git a/modules/ve-mw/i18n/qqq.json b/modules/ve-mw/i18n/qqq.json
index d992247..59b4298 100644
--- a/modules/ve-mw/i18n/qqq.json
+++ b/modules/ve-mw/i18n/qqq.json
@@ -205,7 +205,7 @@
"visualeditor-dialog-transclusion-add-param": "Label for button that
adds a parameter to a transcluded template.",
"visualeditor-dialog-transclusion-add-template": "Label for button that
adds the specified template to the page.\n{{Identical|Add template}}",
"visualeditor-dialog-transclusion-content": "Label for editor of
content between transclusion parts.\n{{Identical|Content}}",
- "visualeditor-dialog-transclusion-contextitem-description": "Message
shown to an editor when they click on a template or group of templates that
form a transclusion, listing the template(s) from which the transclusion is
constructed.\n\n* $1 – the name of the template, or a list of the names of the
templates if there are multiple.",
+ "visualeditor-dialog-transclusion-contextitem-description": "Message
shown to an editor when they click on a template or group of templates that
form a transclusion, listing the template(s) from which the transclusion is
constructed.\n\n* $1 – the name of the template, or a list of the names of the
templates if there are multiple.\n* $2 - number of templates for PLURAL
support.",
"visualeditor-dialog-transclusion-deprecated-parameter": "Tooltip for
deprecated parameter indicator",
"visualeditor-dialog-transclusion-deprecated-parameter-description":
"Label describing that a parameter is deprecated.\n\nParameters:\n* $1 -
Description given in TemplateData for why parameter is deprecated, which may be
empty.",
"visualeditor-dialog-transclusion-loading": "Title for the transclusion
dialog while its contents are loading.\n{{Identical|Loading}}",
diff --git a/modules/ve-mw/ui/contextitems/ve.ui.MWTransclusionContextItem.js
b/modules/ve-mw/ui/contextitems/ve.ui.MWTransclusionContextItem.js
index 2bf43a5..74b9e59 100644
--- a/modules/ve-mw/ui/contextitems/ve.ui.MWTransclusionContextItem.js
+++ b/modules/ve-mw/ui/contextitems/ve.ui.MWTransclusionContextItem.js
@@ -69,7 +69,8 @@
ve.ui.MWTransclusionContextItem.prototype.getDescription = function () {
return ve.msg(
'visualeditor-dialog-transclusion-contextitem-description',
- ve.ce.MWTransclusionNode.static.getDescription( this.model )
+ ve.ce.MWTransclusionNode.static.getDescription( this.model ),
+ ve.ce.MWTransclusionNode.static.getTemplatePartDescriptions(
this.model ).length
);
};
--
To view, visit https://gerrit.wikimedia.org/r/232527
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icdf762b3761227c3fcedefc947ffc512520cff76
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits