Page MenuHomePhabricator

Add uppercase by default to parameter names in TemplateData
Closed, DeclinedPublicFeature

Description

Go to fr.wikipedia.org

Insert a template (with visual editor) that has TemplateData and aliases for all parameters. For example: Ouvrage.
All parameter names are in upper case, which respects linguistic conventions.

image.png (845×895 px, 105 KB)

Insert a other template : Site web
Some parameters are not capitalized, because there was no need to indicate an alias. But, the parameters that have an alias are capitalized. It's not very coherent.

image.png (844×899 px, 120 KB)

Solution: Capitalizing the name of a parameter is extremely redundant. This would require bots to do this automatically on all templates in each wiki. Therefore, the editor should always add the uppercase in parameters names when there is no alias.

Thank you !

Event Timeline

Thomas renamed this task from Add a default capital letter to parameter names in TemplateData to Add uppercase by default to parameter names in TemplateData.Nov 27 2021, 9:57 PM
Thomas updated the task description. (Show Details)

Different wikis have different practices on the use of capital letters in parameter names.

Aklapper changed the subtype of this task from "Task" to "Feature Request".Nov 28 2021, 9:31 AM

@NemoLePoisson: Thanks for reporting this. For future reference, please use the feature request form (linked from the top of the task creation page) to create feature requests. Thanks.

All parameter names are in upper case, which respects linguistic conventions.

I'm afraid this only applies to some languages, and not to other languages. Proposing to decline.

The TemplateData block at Modèle:Infobox Site web#TemplateData doesn’t capitalize these words either, and—as far as I remember—this has ever been the case. In addition to the potential issues in other languages (even in English: for example if there was an {{Infobox iPhone}} with a parameter |iOS version=, it shouldn’t be capitalized), being consistent across interfaces is important; I think it’s even more important than being correct, as consistently incorrect behavior is easier to fix or work around.

thiemowmde subscribed.

Sorry to close this so fast. My team recently worked on TemplateData and the dialog in VisualEditor, see WMDE-Templates-FocusArea. Let's see:

  1. What should be capitalized and what not depends on a lot of things: the author's preferences, the local community's conventions, and most importantly the language.
  2. If you want VisualEditor to show capitalized parameter names, all you need to do is to add labels to these parameters in the template's TemplateData JSON. Example:
"params": {
    "alternative logo": {
        "label": "Alternative logo",
        
    }
}
  1. Another option is to actually capitalize the parameters in the template and turn the lowercase variants into aliases, so they continue to work as before.

It might be technically possible to turn this around, enforce capitalization for all parameters without a label and ask users to add a lowercase label in case they want to undo the capitalization. Our team actually discussed this at one point. We dropped the idea for several reasons:

  • When looking at the wikitext the parameter names aren't capitalized either. Enforcing capitalization in one place but not the other is inconsistent and potentially confusing for users that use both VisualEditor and wikitext.
  • To undo the capitalization the JSON must look like "iOS version": { "label": "iOS version" }. This will certainly cause confusion as it looks like it shouldn't have an effect, but does.
  • This should be rarely needed. I mean, if a wiki's convention is to capitalize parameter names, why not do this and actually capitalize them?