Use "Insert citation" label for apply button of CitationDialog

* Create a method to produce the correct label
* Override that method in the citation dialog subclass

Change-Id: Ic74a23dcf30aae201f3d6c312b760cf058aadf11
This commit is contained in:
Trevor Parscal 2014-03-24 16:54:05 -07:00 committed by James D. Forrester
parent cc45c6a0d1
commit c385c01096
5 changed files with 34 additions and 10 deletions

View file

@ -935,6 +935,7 @@ $wgResourceModules += array(
'ext.visualEditor.mwtransclusion',
),
'messages' => array(
'visualeditor-dialog-citation-insert-citation',
'visualeditor-dialog-reference-insert-button',
'visualeditor-dialog-reference-insert-title',
'visualeditor-dialog-reference-options-group-label',

View file

@ -42,6 +42,7 @@
"visualeditor-dialog-beta-welcome-action-continue": "Continue",
"visualeditor-dialog-beta-welcome-content": "This is our new, easier way to edit. It's still in beta, which means you might find parts of the page you can't edit, or encounter issues that need to be fixed. We encourage you to review your changes, and we welcome reports about any issues you might encounter in using VisualEditor (click the \"{{int:visualeditor-help-tool}}\" button to submit feedback). You can keep using the wikitext editor by clicking the \"$1\" tab instead unsaved changes will be lost.",
"visualeditor-dialog-beta-welcome-title": "{{GENDER:$1|Welcome}} to VisualEditor",
"visualeditor-dialog-citation-insert-citation": "Insert citation",
"visualeditor-dialog-media-alttext-section": "Alternative text",
"visualeditor-dialog-media-content-section": "Caption",
"visualeditor-dialog-media-insert-button": "Insert media",

View file

@ -47,6 +47,7 @@
"visualeditor-dialog-beta-welcome-action-continue": "Used as label for the Continue button which is used to close the dialog and continue using VisualEditor.\n{{Identical|Continue}}",
"visualeditor-dialog-beta-welcome-content": "Text explaining VisualEditor is in beta.\n\nRefers to {{msg-mw|Visualeditor-help-tool}}.\n\nParameters:\n* $1 - {{msg-mw|Edit}}",
"visualeditor-dialog-beta-welcome-title": "Title of the beta welcome dialog. Parameters:\n* $1 - username or empty string, for GENDER support",
"visualeditor-dialog-citation-insert-citation": "Label for button that closes the citation insertion dialog and inserts the citation",
"visualeditor-dialog-media-alttext-section": "Label for the image alternative text sub-section.",
"visualeditor-dialog-media-content-section": "Label for the image content sub-section.\n{{Identical|Caption}}",
"visualeditor-dialog-media-insert-button": "Used as label for the button.\n{{Identical|Insert media}}",

View file

@ -35,6 +35,17 @@ ve.ui.MWCitationDialog.static.icon = 'reference';
/* Methods */
/**
* @inheritdoc
*/
ve.ui.MWCitationDialog.prototype.getApplyButtonLabel = function () {
return ve.msg(
this.inserting ?
'visualeditor-dialog-citation-insert-citation' :
'visualeditor-dialog-action-apply'
);
};
/**
* @inheritdoc
*/

View file

@ -151,7 +151,7 @@ ve.ui.MWTransclusionDialog.prototype.onBookletLayoutSet = function ( page ) {
* @param {ve.dm.MWTransclusionPartModel} added Added part
*/
ve.ui.MWTransclusionDialog.prototype.onReplacePart = function ( removed, added ) {
var i, len, page, name, names, params, partPage, reselect, single,
var i, len, page, name, names, params, partPage, reselect,
removePages = [];
if ( removed ) {
@ -218,16 +218,9 @@ ve.ui.MWTransclusionDialog.prototype.onReplacePart = function ( removed, added )
this.setPageByName( reselect.getName() );
}
// Update widgets related to a transclusion being a single template or not
single = this.isSingleTemplateTransclusion();
this.modeButton.setDisabled( !single );
this.modeButton.setDisabled( !this.isSingleTemplateTransclusion() );
this.applyButton
.setLabel( ve.msg(
!this.inserting ? 'visualeditor-dialog-action-apply' : (
single ?
'visualeditor-dialog-transclusion-insert-template' :
'visualeditor-dialog-transclusion-insert-transclusion'
)
) )
.setLabel( this.getApplyButtonLabel() )
.setDisabled( !this.isInsertable() );
this.updateTitle();
};
@ -306,6 +299,23 @@ ve.ui.MWTransclusionDialog.prototype.getTemplatePartLabel = function ( part ) {
part.getSpec().getLabel() : ve.msg( 'visualeditor-dialog-transclusion-placeholder' );
};
/**
* Get a label for the apply button.
*
* @returns {string} Apply button label
*/
ve.ui.MWTransclusionDialog.prototype.getApplyButtonLabel = function () {
var single = this.isSingleTemplateTransclusion();
return ve.msg(
this.inserting ?
(
single ?
'visualeditor-dialog-transclusion-insert-template' :
'visualeditor-dialog-transclusion-insert-transclusion'
) : 'visualeditor-dialog-action-apply'
);
};
/**
* Set the page by name.
*