Template talk:Label

From Wikimedia Commons, the free media repository
Jump to: navigation, search

Language issues[edit]

This template used by citys template like {{Berlin}} or {{Athens}} but when I try to see it in he.wiki for example (same also in other wikis) it can be seen in English only but the link is ok. For example Athens in he.wiki or Berlin in ar.wiki. Lool loike the format is [[:he:אתונה|Athens]] and not [[:he:אתונה|אתונה]]. -- Geagea (talk) 10:49, 27 July 2016 (UTC)

{{Athens|he}} gives אתונה. The template works, but you are right there is an issue her. phabricator:T140792 already addresses it, please add you comments there. --Jarekt (talk) 12:51, 27 July 2016 (UTC)
✓ Done. -- Geagea (talk) 13:07, 27 July 2016 (UTC)

Performance issue[edit]

This template is massively used in Commons, but largely suffers from evident performance issues when looking up for labels in Wikidata with lots of translations. Apparently it is parsing too much things, more than what is needed. Call it about 100 times in a page, and you'll have exhausted various memory/time limits. verdy_p (talk) 23:27, 8 October 2016 (UTC)

You might be right with performance issues; However I think that any time you use a template 100 times in a page, you might run into trouble. The way of doing the places templates was also very inefficient calling long list of cascading templates and Lua modules. --Jarekt (talk) 18:08, 10 October 2016 (UTC)

Many issues[edit]

There seems to be some issues with this template:

  • {{label|Q1|link=commons}}=Universe: does not link to commons
  • {{label|P25|de}}=Mutter: does not link to de but to an non-existing wikidata page. You should detect that it starts with P and link to Property:xxx
  • {{label|P25|link=wikipedia}}=mother: The link provided is incorrect. You should perhaps not provide a link when the wikipedia link is not provided on wikidata
  • {{label|P25|link=wikidata}}=mother: The link provided is incorrect. You should detect that it starts with P and link to Property:xxx
  • {{label|P25|link=commons}}=mother: The link provided is incorrect. You should perhaps not provide a link when the wikicommons link is not provided on wikidata

Best regards Liné1 (talk) 07:33, 11 May 2017 (UTC)

Jarekt, can you help her. -- Geagea (talk) 12:41, 11 May 2017 (UTC)
Liné1 and Geagea, I actually never used this template with properties and I am not sure why I added in the documentation that you should. I think this is more of the documentation error. template:P is meant for properties. As for d:Q1 there is no sitelink to commons for d:Q1 so it falls back on wikipedia (and than on wikidata). {{label|Q2|link=commons}}=Earth: works fine. --Jarekt (talk) 16:47, 11 May 2017 (UTC)
Hello @Jarekt, Geagea:
I don't mind modifying the documentation to precise that it does not work with Properties. But it is a bit sad, as in lua detecting that the code starts with P is easy.
Regards Liné1 (talk) 16:54, 11 May 2017 (UTC)
Liné1, you are right, it was an easy code change. So it is Pictogram voting keep.svg Fixed now. --Jarekt (talk) 20:00, 11 May 2017 (UTC)
Liné1, I updated the documentation trying to explain the fall-back mechanism of link type choice, but you reverted it. If the sentence is not clear please propose better wording. --Jarekt (talk) 11:48, 12 May 2017 (UTC)
Yes, sorry, I was too quick. I put back your sentence. Sorry Liné1 (talk) 14:41, 12 May 2017 (UTC)


Since a vast amount of labels in Wikidata begin with a lowercase (see Wikidata:Help:Label#Labels in English), I suggest to add a parameter allowing capitalization in labels when it's needed. Currently, one of the ways to capitalize a label is to add <span style="text-transform:capitalize;">, though it isn't the best solution, as you can notice in the gallery page New York City.--Russian Rocky (talk) 04:16, 26 March 2017 (UTC)

Je relance l'idée, c'est une fonctionnalité indispensable pour les titres. En espérant qu'une personne compétente améliore ce modèle.Camulogene77 (talk) 08:59, 6 September 2017 (UTC)
Russian Rocky, Camulogene77 ✓ Done --Jarekt (talk) 13:41, 6 September 2017 (UTC)

Using mw.wikibase.label and mw.wikibase.sitelink functions to prevent loading of the whole entity[edit]

I just deployed rewrite of module:Wikidata label to minimize the need for loading of the whole entity while calling {{label}}. Pleas let me know if there are any issues. --Jarekt (talk) 12:32, 12 October 2017 (UTC)

Deleted Q numbers[edit]

A thought in relation to Commons:Village pump #Error due to deletion of Wikidata item. Wouldn’t be fine to handle an error due to deletion of the Q item specified more gracefully than an error due to incorrect input? @Johnuniq: do you watch here? Also @Slowking4, Ymblanter| Incnis Mrsi (talk) 11:24, 18 January 2018 (UTC)

My apologies, I do not know, not my area of expertise.--Ymblanter (talk) 11:26, 18 January 2018 (UTC)
should Revision of User_talk:Ymblanter be understood as a support for the cause?
A problem is that unless another parameter to label were given, it would have no way of knowing what to output if the Wikidata item were deleted. It could give a more sensible error message, perhaps "d:Q5047871" or "d:Q5047871 does not exist"? It's not clear whether having a tracking category for such errors would be better than just having a script error. The latter has more chance of being fixed. Johnuniq (talk) 03:53, 19 January 2018 (UTC)
First, a category for deleted items would be helpful as a special venue to track “Wikidata deletionism” (Slowking4). Unlike common syntax errors it isn’t a problem always requiring fixing on Commons itself. Second, would you really like to see Lua error in Module:Wikidata_label at line 66: attempt to index local 'entity' (a nil value). in galleries or media descriptions? Note that the text implicates some kind or internal software error… or wait, I’d say that reporting inappropriate input in such a form is a programming error! Incnis Mrsi (talk) 07:52, 19 January 2018 (UTC)