Jump to content

Module talk:Wd

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
(Redirected from Module talk:Wd/i18n/sandbox)

Reference without title

[edit]

If a reference doesn't have a title, the URL isn't shown and "Error: Unable to display the reference properly. See the documentation for details." is shown instead.
Would it be possible to not use {{Cite web}} if there's no title so that the URL is shown? The RedBurn (ϕ) 15:59, 11 May 2024 (UTC)[reply]

This is an as-yet unaddressed problem with the module. See above. – Jonesey95 (talk) 03:47, 13 May 2024 (UTC)[reply]
I plan to improve this error message; in the next ~3 months, if nothing wrong. But I agree with you it would probably be better if we let {{Cite web}} to report missing titles. I thinks so because if the reference rendering fails, the module will need to report two errors (one for {{Cite web}} missing/unknown param on Wikidata, and one error for {{Cite Q}}) – this would be probably too confusing for non-technical editors.
Is anybody opposed to this change?
Janhrach (talk) 09:35, 25 May 2024 (UTC)[reply]
I have made the said change to the sandbox. Here is a result sample:
[1]
Original behavior, for comparison:
[1]
Janhrach (talk) 17:32, 7 June 2024 (UTC)[reply]

References

  1. ^ a b . Federal Statistical Office https://www.pxweb.bfs.admin.ch/pxweb/de/. Retrieved 15 June 2020. {{cite web}}: Missing or empty |title= (help)
@The RedBurn: Oops, I misread to not use {{Cite web}} in your comment as "to use {{Cite web}}". As for this, we could probably not; see this discussion. To quote an editor from the discussion: Titles are required so when {{cite web}} emits a missing title error, that is a good thing, because someone can go to wikidata and fix it.
As for the change I did (even though it's not what you proposed), what do you think of it?
Janhrach (talk) 06:40, 9 June 2024 (UTC)[reply]
Your change is great, I actually thought {{Cite web}} was the culprit for hiding the URL when there's no title. The RedBurn (ϕ) 06:29, 10 June 2024 (UTC)[reply]
Ok, I went ahead and updated the module. Janhrach (talk) 19:18, 10 June 2024 (UTC)[reply]
@Janhrach: This is a huge improvement, thank you! Polygnotus (talk) 19:42, 15 June 2024 (UTC)[reply]

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)[reply]

@Janhrach, Agree. Non Wiki references are only proper references. Arjunaraoc (talk) 11:13, 21 June 2024 (UTC)[reply]
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)[reply]
 Done: module updated. Janhrach (talk) 09:49, 23 June 2024 (UTC)[reply]

Wikipedia article link in plain form needed

[edit]

While creating a variant template for use on Andhra Pradesh Village articles which uses{{ Infobox settlement}}, I needed wikipedia site link text in plain form so that I can change the visible text to remove suffixes in label names like district or mandal. I am unable to do that, as the current linked form gives a full fledged link with site link text and label as its visible text. I am unable to process such text as the response has pipe symbol in it. Is there any other way to get only Wikipedia article link text in plain form? Arjunaraoc (talk) 11:18, 21 June 2024 (UTC)[reply]

I think this module could not output sitelinks (i.e. interwiki links hosted in Wikidata), linked or not. Could you clarify what exact arguments are you giving to the template call? Janhrach (talk) 13:08, 21 June 2024 (UTC)[reply]
Template:Sitelink or parts of its code? Ponor (talk) 13:42, 21 June 2024 (UTC)[reply]
@Ponor, Thanks for your help. It worked. I used the corresponding function from {{WikidataIB}} in my code. @Janhrach, Your response is correct. I wanted the sitelink in plain text form for the same language, instead of link form with label. Arjunaraoc (talk) 00:57, 22 June 2024 (UTC)[reply]

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)[reply]

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)[reply]

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)[reply]

 Done: module updated. Janhrach (talk) 09:50, 9 August 2024 (UTC)[reply]

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)[reply]

Thanks for the info — Martin (MSGJ · talk) 18:46, 15 August 2024 (UTC)[reply]
 Done. Janhrach (talk) 09:45, 26 August 2024 (UTC)[reply]

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)[reply]

 Done. Janhrach (talk) 17:06, 2 September 2024 (UTC)[reply]
[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)[reply]

@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) to label = 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 remove getLabelByLang() 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 getDescription() (and not getDescriptionByLang()) 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)[reply]
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)[reply]
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)[reply]
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)[reply]