Page MenuHomePhabricator

Generic template added to description for WLM dominates description over language alternatives
Closed, InvalidPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:
Shows text from a template, and not even full text (id is not shown):

This is a photo of a monument in Poland identified by the ID:

What should have happened instead?:

Should show actual, iundividual description like:

Church of the Assumption in Tarnobrzeg, the painting show Our Lady and St. Dominic

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):
Commons.

Other information (browser name/version, screenshots, etc.):
Firefox 129, Windows 11.

obraz.png (1×1 px, 2 MB)

obraz.png (284×1 px, 29 KB)

Event Timeline

Assuming you want a short description without links, I think it would be best to use structural descriptions. Take a structural description in the user/content language, with a fallback to English. Otherwise, you could try building a summary from templates like 'de', 'pl', 'en', etc.

simon04 subscribed.

The template parsing is performed by the CommonsMetadata extension.

Related issue: T205699

The problem here is that the monument template outputs this HTML fragment:

<div lang="en" dir="ltr" class="description en" style="display:inline;">... This is a photo of a monument in Poland identified by the ID:</div>

... and the extension for extracting the description picks up HTML elements with the class description.

@Nux, what is the reason to wrap this (fragment of a) sentence inside a class description? Can the class description be dropped?

Problem was actually due to using the lang template, so I fixed that:
https://commons.wikimedia.org/w/index.php?title=Template:Zabytek_nieruchomy/layout&diff=next&oldid=933521494

Should we document that the lang template should not be used in most cases? The lang template was adding <div lang="en" dir="ltr" class="description en" style="display:inline;">. I was not aware that this is influencing MediaViewer and in a way hijacking actual description.

The relevant logic is TemplateParser::parseContents(); maybe it could concatenate entries in the same language instead of overriding the previous one. But it's probably better to not put the monument ID in the description anyway, it's just not that relevant. {{lang}} should not cause any confusion when it's used outside the description field of {{Information}}.

It is a community decision how to use templates. The extension looks at the generated html. Each localized sub-template passed the lang code and that is used to generate a html lang code.

The description class exists since 2006 - https://commons.wikimedia.org/w/index.php?title=Template:Lang&diff=prev&oldid=3823653
The extension seems to be build in 2013 - 873a607260696702f6d87bb3f981efab03181fa4 - but I would assume this was done based on the local community or existing templates.