Page MenuHomePhabricator

Messages mwe-upwiz-error-too-short and mwe-upwiz-error-too-long are reused, sometimes passed wrong parameters
Closed, ResolvedPublic

Description

Messages 'mwe-upwiz-error-too-short' and 'mwe-upwiz-error-too-long':

	"mwe-upwiz-error-too-long": "This entry is too long.\nPlease make this entry shorter than $1 {{PLURAL:$1|character|characters}}.",
	"mwe-upwiz-error-too-short": "This entry is too short.\nPlease make this entry longer than $1 {{PLURAL:$1|character|characters}}.",

They are used as error messages in two places, and while the text is correct in one of them, it should actually be "at most" / "at least" ("shorter or equal to" / "longer or equal to") in the other:

/resources/mw.UploadWizardDescription.js
			return this.input.rules( 'add', {
				minlength: mw.UploadWizard.config.minDescriptionLength,
				maxlength: mw.UploadWizard.config.maxDescriptionLength,
				required: required,
				messages: {
					required: mw.message( 'mwe-upwiz-error-blank' ).escaped(),
					minlength: mw.message( 'mwe-upwiz-error-too-short', mw.UploadWizard.config.minDescriptionLength - 1 ).escaped(),
					maxlength: mw.message( 'mwe-upwiz-error-too-long', mw.UploadWizard.config.maxDescriptionLength + 1 ).escaped()
				}
			} );
/resources/mw.UploadWizardDeed.js
					rules: {
						source: {
							required: true,
							minlength: config.minSourceLength,
							maxlength: config.maxSourceLength
						},
						author: {
							required: true,
							minlength: config.minAuthorLength,
							maxlength: config.maxAuthorLength
						}
					},
					messages: {
						source: {
							required: mw.message( 'mwe-upwiz-error-blank' ).escaped(),
							minlength: mw.message( 'mwe-upwiz-error-too-short', config.minSourceLength ).escaped(),
							maxlength: mw.message( 'mwe-upwiz-error-too-long', config.maxSourceLength ).escaped()
						},
						author: {
							required: mw.message( 'mwe-upwiz-error-blank' ).escaped(),
							minlength: mw.message( 'mwe-upwiz-error-too-short', config.minAuthorLength ).escaped(),
							maxlength: mw.message( 'mwe-upwiz-error-too-long', config.maxAuthorLength ).escaped()
						}
					}

I tracked this down to change b50287a66674e98e56d3c76d084f1bc572898fc9 (https://gerrit.wikimedia.org/r/#/c/148410/), which changed the code to match the messages in one place, but forgot the other.

As the configuration settings defining the lengths are usually nice round numbers, I think it would be best to undo that change and instead update the messages. (This was even pointed out in post-merge review, heh.)

Event Timeline

matmarex raised the priority of this task from to Needs Triage.
matmarex updated the task description. (Show Details)
matmarex added projects: UploadWizard, I18n.
matmarex subscribed.
Restricted Application added subscribers: StudiesWorld, Steinsplitter, Aklapper. · View Herald Transcript
MarkTraceur subscribed.
matmarex added a project: Google-Code-In-2015.
matmarex set Security to None.

Change 263185 had a related patch set uploaded (by Ananay):
Messages mwe-upwiz-error-too-short and mwe-upwiz-error-too-long are reused, sometimes passed wrong parameters

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

Change 263185 merged by jenkins-bot:
Pass correct parameters to mwe-upwiz-error-too-short and mwe-upwiz-error-too-long

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