Content deleted Content added
m Archiving 1 discussion(s) from Module talk:Wd) (bot |
m Archiving 1 discussion(s) from Module talk:Wd) (bot |
||
Line 1,641:
:{{done}}. [[User:Janhrach|Janhrach]] ([[User talk:Janhrach|talk]]) 17:06, 2 September 2024 (UTC)
==Discussion at Template talk:Wikidata entity link § Not picking up mul labels from Wikidata entities==
[[File:Symbol watching blue lashes high contrast.svg|25px|link=|alt=]] You are invited to join the discussion at [[:Template talk:Wikidata entity link#Not picking up mul labels from Wikidata entities|Template talk:Wikidata entity link § Not picking up mul labels from Wikidata entities]]. [[User:Peaceray|Peaceray]] ([[User talk:Peaceray|talk]]) 01:10, 30 August 2024 (UTC)<!-- [[Template:Please see]] -->
:@[[User:Thayts|Thayts]], [[User:Janhrach|Janhrach]], et al.: What do you think? I was thinking to change [[Module:Wd#L-704]] from <syntaxhighlight lang=lua inline>label = mw.wikibase.getLabelByLang(id, self.langCode)</syntaxhighlight> to <syntaxhighlight lang=lua inline>label = mw.wikibase.getLabelByLang(id, self.langCode) or mw.wikibase.getLabel(id)</syntaxhighlight> (at least as an interim step). Is this the right thing to do or should we just remove <code>getLabelByLang()</code> all together? Currently it is also being (mis)used at [[Module:Wd#L-1294]] (with a hardcoded "en" for the language). Incidentally this module currently also uses <code>getDescription()</code> (and not <code>getDescriptionByLang()</code>) at [[Module:Wd#L-2523]]. It seems like the language usage (and their fallbacks) is not very unified here. Thank you, —[[User:Uzume|Uzume]] ([[User talk:Uzume|talk]]) 15:11, 30 August 2024 (UTC)
::I am not familiar with the Wikibase API. As for the status quo, it is not good and I already have had to fix a bug arising from a lack of label fallback. I don't know whether <code>getLabel</code> provides a good fallback mechanism, and I don't now have time to check the documentation. (Though maybe tomorrow I will have.)
::As for the {{tq|hardcoded "en"}}, it is required that the language is hardcoded, because the fetched label is used in a Geohack call. (However, I find it much preferable for this string to be fetched from a WD property and not from the label, because in the future, there will be no guarantee that the label will be accepted as a Geohack param.) [[User:Janhrach|Janhrach]] ([[User talk:Janhrach|talk]]) 19:26, 1 September 2024 (UTC)
:::Update: I found the documentation is linked in the linked discussion, so I didn't have to search for it. It seems that it is desirable use getLabel only. There may arise some issues, but they would (in my speculation) only affect multilingual wikis. I will look into this possible bug later. [[User:Janhrach|Janhrach]] ([[User talk:Janhrach|talk]]) 19:36, 1 September 2024 (UTC)
::::The hypothetical bug I have mentioned quite probably won't arise, so ignore this part of the comment. [[User:Janhrach|Janhrach]] ([[User talk:Janhrach|talk]]) 17:53, 2 September 2024 (UTC)
===Proposed fix===
I made a fix to the sandbox. Sample output:
*English label:
**live module: {{#invoke:wd|label|Q46}}
**sandbox: {{#invoke:wd/sandbox|label|Q46}}
*Multilingual label:
**live module: {{#invoke:wd|label|Q42}}
**sandbox: {{#invoke:wd/sandbox|label|Q42}}
—[[User:Janhrach|Janhrach]] ([[User talk:Janhrach|talk]]) 16:36, 8 September 2024 (UTC)
:{{done}}. [[User:Janhrach|Janhrach]] ([[User talk:Janhrach|talk]]) 18:29, 12 September 2024 (UTC)
|