Module talk:Wd
Module:Wd is permanently protected from editing because it is a heavily used or highly visible module. Substantial changes should first be proposed and discussed here on this page. If the proposal is uncontroversial or has been discussed and is supported by consensus, editors may use {{edit template-protected}} to notify an administrator or template editor to make the requested edit.
|
This is the talk page for discussing improvements to the Wd module. |
|
Archives: 1Auto-archiving period: 90 days |
This module does not require a rating on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||
|
Use Wikipedia talk:Wikidata for general Wikidata support discussions. |
Related pages |
---|
imported from Wikimedia project (P143) and Wikimedia import URL (P4656) in references
[edit]I propose to modify the module to ignore references containing these properties. This seems to be the correct way of handling them – these references should not contain any information useful for Wikipedia references. Any thoughts? Janhrach (talk) 15:17, 15 June 2024 (UTC)
- @Janhrach, Agree. Non Wiki references are only proper references. Arjunaraoc (talk) 11:13, 21 June 2024 (UTC)
- I have made the change to the sandbox. References containing inferred from (P3452) are also fully ignored. Janhrach (talk) 16:41, 21 June 2024 (UTC)
- Done: module updated. Janhrach (talk) 09:49, 23 June 2024 (UTC)
2 urls in source
[edit]There are 2 URLs in the source of the 2023 population data on this page: reference URL However, one of them appears on Wikipedia. Is it possible for 2 URLs to appear? Sadrettin (talk) 10:21, 24 June 2024 (UTC)
- No, it is not possible for a Wikipedia reference to have two URLs. I am not sure if the Wikidata reference you mentioned is valid; it is possible the reference should be split into two (the first reference would contain the first URL, and the second reference would contain the second URL) even if the other metadata are the same. Janhrach (talk) 07:36, 29 June 2024 (UTC)
Update
[edit]I made some substantial changes to the sandbox. I simplified the internal logic of the citation-rendering function and renamed local variables to less cryptic names. No visible behavioral changes changed should happen. Some testcases are here. If there is no opposition to the changes for several days, I will update the main module. Janhrach (talk) 19:59, 5 August 2024 (UTC)
- Done: module updated. Janhrach (talk) 09:50, 9 August 2024 (UTC)
Another update
[edit]I once again altered the internal workings of the citation-rendering function in the sandbox, but also /i18n. Apart from a bugfix, in this update I tried to make much template- and param-specific behavior (previously hardcoded into the function) configurable in /i18n. Changes to /i18n are not backward-compatible. Some testcases are here. Janhrach (talk) 18:40, 15 August 2024 (UTC)
- Thanks for the info — Martin (MSGJ · talk) 18:46, 15 August 2024 (UTC)
- Done. Janhrach (talk) 09:45, 26 August 2024 (UTC)
Reference error message improvement
[edit]Finally, I improved the reference error messages. The code is in the sandbox. /i18n
has also been modified. You can see the difference of the outputs here. I appreciate your feedback. Janhrach (talk) 17:17, 27 August 2024 (UTC)
Discussion at Template talk:Wikidata entity link § Not picking up mul labels from Wikidata entities
[edit]You are invited to join the discussion at Template talk:Wikidata entity link § Not picking up mul labels from Wikidata entities. Peaceray (talk) 01:10, 30 August 2024 (UTC)
- @Thayts, Janhrach, et al.: What do you think? I was thinking to change Module:Wd#L-704 from
label = mw.wikibase.getLabelByLang(id, self.langCode)
tolabel = mw.wikibase.getLabelByLang(id, self.langCode) or mw.wikibase.getLabel(id)
(at least as an interim step). Is this the right thing to do or should we just removegetLabelByLang()
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 usesgetDescription()
(and notgetDescriptionByLang()
) at Module:Wd#L-2523. It seems like the language usage (and their fallbacks) is not very unified here. Thank you, —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
getLabel
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
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.) 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. 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. Janhrach (talk) 17:53, 2 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. Janhrach (talk) 19:36, 1 September 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
Proposed fix
[edit]I made a fix to the sandbox. Sample output:
- English label:
- live module: Europe
- sandbox: Europe
- Multilingual label:
- live module: Douglas Adams
- sandbox: Douglas Adams