mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 06:24:08 +00:00
Consolidate messages about missing/bad templates
This is mostly re-arranging existing code. Actual changes made: * Remove the message that claims a template can't exist. We can't really know this. * Instead show the message about "modifiers" in cases where curly braces and other wikitext syntax is involved. Bug: T290140 Change-Id: I713d7f54cad2510f9a02c113600980cba8c3e58b
This commit is contained in:
parent
34cbc3f3b5
commit
224cc9ab12
|
@ -2229,7 +2229,6 @@
|
|||
"visualeditor-dialog-transclusion-absent-template",
|
||||
"visualeditor-dialog-transclusion-template-title-nonexistent",
|
||||
"visualeditor-dialog-transclusion-template-title-modifier",
|
||||
"visualeditor-dialog-transclusion-template-title-invalid",
|
||||
"visualeditor-dialog-transclusion-options",
|
||||
"visualeditor-dialog-transclusion-param-default",
|
||||
"visualeditor-dialog-transclusion-param-example",
|
||||
|
|
|
@ -173,7 +173,6 @@
|
|||
"visualeditor-dialog-transclusion-absent-template": "The \"$1\" template doesn't yet exist.",
|
||||
"visualeditor-dialog-transclusion-template-title-nonexistent": "This template doesn't exist.",
|
||||
"visualeditor-dialog-transclusion-template-title-modifier": "Template documentation and [//www.mediawiki.org/wiki/Manual:Glossary#Parameter parameter] names (if existing) are not available when editing templates using modifiers, such as [//www.mediawiki.org/wiki/Help:Substitution subst].",
|
||||
"visualeditor-dialog-transclusion-template-title-invalid": "This template can not exist since its name is invalid.",
|
||||
"visualeditor-dialog-transclusion-add-content": "Add content",
|
||||
"visualeditor-dialog-transclusion-add-wikitext": "Add wikitext",
|
||||
"visualeditor-dialog-transclusion-add-param": "Add more information",
|
||||
|
@ -219,7 +218,7 @@
|
|||
"visualeditor-dialog-transclusion-required-parameter-dialog-ok": "Continue anyway",
|
||||
"visualeditor-dialog-transclusion-required-parameter-dialog-title": "Required {{PLURAL:$1|field|fields}} missing",
|
||||
"visualeditor-dialog-transclusion-required-parameter-is-blank": "Are you sure you want to continue without filling the $1 {{PLURAL:$2|field|fields}}?",
|
||||
"visualeditor-dialog-transclusion-see-template": "Templates are user-generated and may lack complete descriptions. There might be additional information on this [[$1|template's page]].",
|
||||
"visualeditor-dialog-transclusion-see-template": "Templates are user-generated and may lack complete descriptions. There might be additional information on this [[$2|template's page]].",
|
||||
"visualeditor-dialog-transclusion-suggestedvalues-warning": "This is not one of the suggested values and may not work with the template.",
|
||||
"visualeditor-dialog-transclusion-title-insert-template": "Insert a template",
|
||||
"visualeditor-dialog-transclusion-title-insert-known-template": "Insert: $1",
|
||||
|
|
|
@ -188,10 +188,9 @@
|
|||
"visualeditor-dialog-template-insert": "Title for the template dialog to insert a new template.",
|
||||
"visualeditor-dialog-template-title": "{{Identical|Template}}",
|
||||
"visualeditor-dialog-transclusion-action-save": "Label for button that saves changes when editing an existing transclusion in the transclusion dialog.",
|
||||
"visualeditor-dialog-transclusion-absent-template": "Message to user that the template they have selected does not exist on this wiki.\n\nParameters:\n* $1 - The title of the template.",
|
||||
"visualeditor-dialog-transclusion-template-title-nonexistent": "Message to user that the template name they have provided does not exist on this wiki.",
|
||||
"visualeditor-dialog-transclusion-template-title-modifier": "Message to user that the template name they have provided contains a modifier.",
|
||||
"visualeditor-dialog-transclusion-template-title-invalid": "Message to user that the template name they have provided is invalid.",
|
||||
"visualeditor-dialog-transclusion-absent-template": "Message to user that the template they have selected does not exist on this wiki.\n\nParameters:\n* $1 - Human-readable name of the template.\n* $2 - Full page name of the template.",
|
||||
"visualeditor-dialog-transclusion-template-title-nonexistent": "Message to user that the template name they have provided does not exist on this wiki.\n\nParameters:\n* $1 - Human-readable name of the template.\n* $2 - Full page name of the template.",
|
||||
"visualeditor-dialog-transclusion-template-title-modifier": "Message to user that the template name they have provided contains a modifier.\n\nParameters:\n* $1 - Human-readable name of the template.\n* $2 - Full page name of the template.",
|
||||
"visualeditor-dialog-transclusion-add-content": "Label for button that adds parameter content to a transclusion.",
|
||||
"visualeditor-dialog-transclusion-add-wikitext": "Label for button that adds parameter wikitext to a transclusion.",
|
||||
"visualeditor-dialog-transclusion-add-param": "Label for button that adds a parameter to a transcluded template.",
|
||||
|
@ -214,11 +213,11 @@
|
|||
"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}}",
|
||||
"visualeditor-dialog-transclusion-more-template-description": "Message to user that additional template information might be available for a template.\n\nParameters:\n* $1 - The name of the template.\n* $2 - The title of the template.",
|
||||
"visualeditor-dialog-transclusion-more-template-description": "Message to user that additional template information might be available for a template.\n\nParameters:\n* $1 - Human-readable name of the template.\n* $2 - Full page name of the template.",
|
||||
"visualeditor-dialog-transclusion-multipart-message": "Message displayed when a transclusion with multiple parts is edited.",
|
||||
"visualeditor-dialog-transclusion-no-parameters-description": "Message to user that no documented parameters were found for the template.",
|
||||
"visualeditor-dialog-transclusion-no-template-data-description": "Message to user that no information on the template's parameters is available for the template.\n\nParameters:\n* $1 - The title of the template.",
|
||||
"visualeditor-dialog-transclusion-no-template-description": "Message to user that no template information is available for the template.\n\nParameters:\n* $1 - The name of the template.\n* $2 - The title of the template.",
|
||||
"visualeditor-dialog-transclusion-no-template-description": "Message to user that no template information is available for the template.\n\nParameters:\n* $1 - Human-readable name of the template.\n* $2 - Full page name of the template.",
|
||||
"visualeditor-dialog-transclusion-options": "Label for section with options for templates, content or parameters.\n{{Identical|Options}}",
|
||||
"visualeditor-dialog-transclusion-param-default": "Label for parameter's default value in the template dialog. $1 - Parameter's default value.\n{{Identical|Default}}",
|
||||
"visualeditor-dialog-transclusion-param-example": "Label for parameter's example value in the template dialog. $1 - Parameter's example value.",
|
||||
|
@ -237,7 +236,7 @@
|
|||
"visualeditor-dialog-transclusion-required-parameter-dialog-ok": "Label for the OK button on the confirmation dialog opened if the user tries to insert/edit a template without filling all required fields.\n{{Identical|Continue anyway}}",
|
||||
"visualeditor-dialog-transclusion-required-parameter-dialog-title": "Title for the confirmation dialog opened if the user tries to insert/edit a template without filling all required fields.\n\nParameters:\n* $1 - Number of parameters missing, for PLURAL support.",
|
||||
"visualeditor-dialog-transclusion-required-parameter-is-blank": "Label for the confirmation dialog opened if the user tries to insert/edit a template without filling all required fields.\n\nParameters:\n* $1 - Parameters missing, as a list using {{msg-mw|and}}, {{msg-mw|comma-separator}} and {{msg-mw|word-separator}}.\n* $2 - Number of parameters missing, for PLURAL support.",
|
||||
"visualeditor-dialog-transclusion-see-template": "Message to user that additional template information might be available for a template.\n\nParameters:\n* $1 - The title of the template.",
|
||||
"visualeditor-dialog-transclusion-see-template": "Message to user that additional template information might be available for a template.\n\nParameters:\n* $1 - Human-readable name of the template.\n* $2 - Full page name of the template.",
|
||||
"visualeditor-dialog-transclusion-suggestedvalues-warning": "Message shown to an editor when they manually add a value that is not a suggested value for a parameter.",
|
||||
"visualeditor-dialog-transclusion-title-insert-template": "Label for the transclusion dialog when selecting a transclusion to insert.",
|
||||
"visualeditor-dialog-transclusion-title-insert-known-template": "Label for the transclusion dialog when editing a transclusion to insert.\n\nParameters:\n* $1 - Transclusion name.",
|
||||
|
|
|
@ -49,56 +49,56 @@ ve.ui.MWTemplatePage = function VeUiMWTemplatePage( template, name, config ) {
|
|||
// template is called, nor link to the template page. However, if we know for
|
||||
// certain that the template doesn't exist, be explicit about it (T162694).
|
||||
var linkData = ve.init.platform.linkCache.getCached( '_missing/' + link ),
|
||||
pageMissing = link && linkData && linkData.missing;
|
||||
knownAsMissing = link && linkData && linkData.missing;
|
||||
|
||||
if ( link ) {
|
||||
if ( this.spec.getDescription() ) {
|
||||
this.$description
|
||||
.append(
|
||||
$( '<hr>' ),
|
||||
$( '<span>' )
|
||||
.addClass( 've-ui-mwTemplatePage-description-extra' )
|
||||
.append(
|
||||
!veConfig.transclusionDialogNewSidebar ?
|
||||
mw.message( 'visualeditor-dialog-transclusion-more-template-description',
|
||||
this.spec.getLabel(), link ).parseDom() :
|
||||
mw.message( 'visualeditor-dialog-transclusion-see-template',
|
||||
link ).parseDom()
|
||||
)
|
||||
);
|
||||
} else if ( pageMissing ) {
|
||||
var msg,
|
||||
templateLabel = this.spec.getLabel();
|
||||
|
||||
if ( veConfig.transclusionDialogNewSidebar ) {
|
||||
msg = mw.message(
|
||||
templateLabel.match( /:/ ) ?
|
||||
'visualeditor-dialog-transclusion-template-title-modifier' :
|
||||
'visualeditor-dialog-transclusion-template-title-nonexistent'
|
||||
);
|
||||
} else {
|
||||
msg = mw.message(
|
||||
'visualeditor-dialog-transclusion-absent-template',
|
||||
templateLabel
|
||||
);
|
||||
}
|
||||
this.$description
|
||||
.addClass( 've-ui-mwTemplatePage-description-missing' )
|
||||
.append( msg.parseDom() );
|
||||
} else if ( !veConfig.transclusionDialogNewSidebar || this.spec.isDocumented() ) {
|
||||
this.$description
|
||||
.addClass( 've-ui-mwTemplatePage-description-missing' )
|
||||
.append( mw.message(
|
||||
'visualeditor-dialog-transclusion-no-template-description',
|
||||
this.spec.getLabel(), link
|
||||
).parseDom() );
|
||||
var key,
|
||||
messageStyle = 've-ui-mwTemplatePage-description-missing',
|
||||
$addMessageHere = this.$description;
|
||||
if ( this.spec.getDescription() ) {
|
||||
key = !veConfig.transclusionDialogNewSidebar ?
|
||||
'visualeditor-dialog-transclusion-more-template-description' :
|
||||
'visualeditor-dialog-transclusion-see-template';
|
||||
messageStyle = 've-ui-mwTemplatePage-description-extra';
|
||||
$addMessageHere = $( '<span>' );
|
||||
this.$description.append( $( '<hr>' ), $addMessageHere );
|
||||
} else if ( !veConfig.transclusionDialogNewSidebar ) {
|
||||
if ( knownAsMissing ) {
|
||||
key = 'visualeditor-dialog-transclusion-absent-template';
|
||||
} else if ( link ) {
|
||||
key = 'visualeditor-dialog-transclusion-no-template-description';
|
||||
}
|
||||
ve.targetLinksToNewWindow( this.$description[ 0 ] );
|
||||
} else if ( veConfig.transclusionDialogNewSidebar ) {
|
||||
this.$description
|
||||
.addClass( 've-ui-mwTemplatePage-description-missing' )
|
||||
.append( mw.message( 'visualeditor-dialog-transclusion-template-title-invalid' ).parseDom() );
|
||||
// Note this leaves dynamic template names like {{ {{foo}} }} without a message.
|
||||
} else if ( !link || knownAsMissing ) {
|
||||
var title;
|
||||
try {
|
||||
title = link && new mw.Title( link );
|
||||
} catch ( e ) {
|
||||
}
|
||||
// When {{User:Foo}} can be parsed as "Foo", we know the ":" is not syntax.
|
||||
key = title && title.getMain().indexOf( ':' ) === -1 ?
|
||||
'visualeditor-dialog-transclusion-template-title-nonexistent' :
|
||||
'visualeditor-dialog-transclusion-template-title-modifier';
|
||||
} else if ( this.spec.isDocumented() ) {
|
||||
key = 'visualeditor-dialog-transclusion-no-template-description';
|
||||
}
|
||||
// Note this leaves existing templates without TemplateData without a message, not even a link!
|
||||
|
||||
if ( key ) {
|
||||
// The following classes are used here:
|
||||
// * ve-ui-mwTemplatePage-description-extra
|
||||
// * ve-ui-mwTemplatePage-description-missing
|
||||
$addMessageHere.addClass( messageStyle )
|
||||
// The following messages are used here:
|
||||
// * visualeditor-dialog-transclusion-absent-template
|
||||
// * visualeditor-dialog-transclusion-more-template-description
|
||||
// * visualeditor-dialog-transclusion-no-template-description
|
||||
// * visualeditor-dialog-transclusion-see-template
|
||||
// * visualeditor-dialog-transclusion-template-title-modifier
|
||||
// * visualeditor-dialog-transclusion-template-title-nonexistent
|
||||
.append( mw.message( key, this.spec.getLabel(), link ).parseDom() );
|
||||
ve.targetLinksToNewWindow( $addMessageHere[ 0 ] );
|
||||
}
|
||||
|
||||
this.$description.find( 'a[href]' )
|
||||
.on( 'click', function () {
|
||||
ve.track( 'activity.transclusion', { action: 'template-doc-link-click' } );
|
||||
|
@ -107,7 +107,7 @@ ve.ui.MWTemplatePage = function VeUiMWTemplatePage( template, name, config ) {
|
|||
this.infoFieldset.$element
|
||||
.append( this.$description );
|
||||
|
||||
if ( veConfig.transclusionDialogNewSidebar && !pageMissing ) {
|
||||
if ( veConfig.transclusionDialogNewSidebar && !knownAsMissing ) {
|
||||
var noticeWidget;
|
||||
|
||||
if ( !this.template.getSpec().getDocumentedParameterOrder().length ) {
|
||||
|
|
Loading…
Reference in a new issue