Page MenuHomePhabricator

First letter of parameters should be capitalized in template editor
Closed, ResolvedPublic

Description

Steps to reproduce:

  • Add TemplateData without adding a label to the parameters

Expected result:

  • Parameters are shown in the template editor with their first letter capitalized

Actual result:

  • Parameters are shown in the template editor in small caps

In the template documentation, parameters without a label are shown with their first letter capitalized:

In template doc.png (734×931 px, 34 KB)

https://fr.wikipedia.org/w/index.php?title=Mod%C3%A8le:Infobox_Sportif/Documentation&oldid=140248892#TemplateData

However, this isn't the case in the template editor:

In template editor.png (650×681 px, 50 KB)

Since this first letter capitalized form is the correct one, this should also be the case in the template editor.

Fixing this would save editors lots of time, by sparing them the highly repetitive task of capitalizing all parameters first letter.

Event Timeline

I can't reproduce this problem on the beta cluster. I tried adding Template:Refbegin to a page, and the labels were correctly capitalised.

The JSON defining the TemplateData does not have the labels capitalised (see screenshot below), and they're displayed that way accordingly in VisualEditor. It seems more like the mistake here is that they're shown capitalised on the TemplateData page when they're not capitalised in the JSON.

Screen Shot 2017-09-05 at 20.42.19.png (926×2 px, 156 KB)

There's still seems to be something odd going on here though. In the specific example you gave, Modèle:Infobox sportif, the JSON was pretty empty and no aliases were defined for any of the parameters. So, I looked for another example. With Modèle:Lien web, some of the parameter labels were capitalised and others weren't. I dug a bit deeper, and it seems like all the ones that were capitalised did not have an alias that was exactly the same as the label, and all the ones that weren't capitalised had an alias that is the same as the label. That does not seem like a coincidence.

In the below screenshot, we see for example that "Titre de la page" and "Adresse web (URL)" are capitalised, whereas "langue", "site", and "date" are not. If we look at the template data for these parameters, the first two do not have an alias that's the same as the label, and the other three do not.

Screen Shot 2017-09-05 at 20.34.57.png (770×860 px, 82 KB)

Screen Shot 2017-09-05 at 20.37.38.png (390×2 px, 61 KB)

Screen Shot 2017-09-05 at 20.37.55.png (466×2 px, 105 KB)

Screen Shot 2017-09-05 at 20.37.24.png (434×2 px, 81 KB)

Screen Shot 2017-09-05 at 20.38.24.png (340×2 px, 74 KB)

I don't know what you meant in T174771#3581686, there's no TemplateData for https://simple.wikipedia.beta.wmflabs.org/wiki/Template:Refbegin so of course it can't be reproduced with that template.

I created https://deployment.wikimedia.beta.wmflabs.org/wiki/Template:Infobox_person and could reproduce on https://deployment.wikimedia.beta.wmflabs.org/wiki/Main_Page/sandbox?veaction=edit by adding Template:Infobox_person:

T174771.png (625×630 px, 26 KB)

Notice that only Name and Caption are capitalized, because these are the only ones I added a Label to.
However, the other parameters (without label) should be capitalized too by default, to save editors time.

I don't know what you meant in T174771#3581686, there's no TemplateData for https://simple.wikipedia.beta.wmflabs.org/wiki/Template:Refbegin so of course it can't be reproduced with that template.

I tested on the English, not Simple English. There is TemplateData there for that template.

I created https://deployment.wikimedia.beta.wmflabs.org/wiki/Template:Infobox_person and could reproduce on https://deployment.wikimedia.beta.wmflabs.org/wiki/Main_Page/sandbox?veaction=edit by adding Template:Infobox_person:

T174771.png (625×630 px, 26 KB)

Yep. Exactly.

Notice that only Name and Caption are capitalized, because these are the only ones I added a Label to.
However, the other parameters (without label) should be capitalized too by default, to save editors time.

Probably, yes.

This bug is somewhat confusing, but editors at en.WP are definitely being confused by the capitalization of the first character of the bolded label, even though the parameter name, which is all-lower-case, is being used as the label.

See this templatedata example:

https://en.wikipedia.org/w/index.php?title=Template:Speciesbox/doc&oldid=994660729

The parameter "color_as" is shown as "Color_as", which is incorrect, in the first column. If no label is provided, the bold duplicate label should be shown using the same case as the parameter.

Actual editor confusion is in evidence here:
https://en.wikipedia.org/w/index.php?title=Wikipedia_talk:WikiProject_Birds&oldid=995782031#Caption_for_range_map_doesn't_appear.

https://en.wikipedia.org/w/index.php?title=Template_talk:Speciesbox&oldid=995784303

Change 651752 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/TemplateData@master] Remove inconsistent capitalization of parameter names

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

Change 651752 merged by jenkins-bot:
[mediawiki/extensions/TemplateData@master] Remove inconsistent capitalization of parameter names

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

thiemowmde claimed this task.
thiemowmde subscribed.

I will mark this as resolved now, even if we ended doing something slightly different. The more common, less confusing and less error-prone behavior appears to be the one without capitalization. If people really want the opposite, I suggest to open a new ticket and make sure …

  1. the same happens in all places: In the TemplateData table on the template page, in VisualEditor, in MediaWiki-extensions-TemplateWizard, and possibly more codebases that work with the TemplateData JSON blobs.
  2. auto-capitalization is fine in all languages.