Content deleted Content added
(25 intermediate revisions by 7 users not shown) | |||
Line 16:
== Support for P5017 ''last update'' ==
{{ping|Thayts|Janhrach}} Hi. Is it possible to add support for [[:d:Property:P5017|P5017 ''last update'']] property? It seems to be perfectly valid citation/reference property for continuously updated sources to indicate last-update date of the version actually cited and it is being used all over WD this way, see [[d:Special:WhatLinksHere/Property:P5017|backlinks]] and [https://linkcount.toolforge.org/?project=www.wikidata.org&page=Property%3AP5017 stat]. Right now rendering attempt of a citation having this property filled here on enwiki leads to a nasty error output:
:<code><nowiki>{{#invoke:wd|reference|Q733993|P2046}}</nowiki></code> → <ref name="wikidata-8d9471ae1372c5ce8f22dc9a33852d9f3e9a6bc3-v18"><span style="color:#dd3333">
Line 47 ⟶ 46:
{{reflist-talk}}
=== Proposed fix ===
I have implemented (in /sandbox) support for configuring the module (in /i18n) for using multiple Wikidata properties as sources for citation paramenters. These properties are ordered – each has it priority, which determines when to use the said property. I used this functionality to fix the above issue. (Both ''publication date'' and ''last update'' are used as a source for the {{mono|date}} citation argument, but ''last update'' has higher priority.) I also used this mechanism to reimplement the usage of ''subject named as'' as a fallback for {{mono|title}}. Your comments are welcome. [[User:Janhrach|Janhrach]] ([[User talk:Janhrach|talk]]) 16:48, 6 July 2025 (UTC)
:{{done}}. Implemented. [[User:Janhrach|Janhrach]] ([[User talk:Janhrach|talk]]) 19:55, 22 July 2025 (UTC)
== Intenationalisation of dates ==
Line 115 ⟶ 61:
:::Thanks! [[User:Julius Schwarz|Julius Schwarz]] ([[User talk:Julius Schwarz|talk]]) 07:20, 9 June 2025 (UTC)
:::Actually @[[User:Janhrach|Janhrach]], even though this is not currently feasible in Wd, how would you go about adding an "s" to the currency in a forked module? Assuming the currency value is always plural. [[User:Julius Schwarz|Julius Schwarz]] ([[User talk:Julius Schwarz|talk]]) 07:24, 9 June 2025 (UTC)
::::Has Ahecht already answered your questtion? [[User:Janhrach|Janhrach]] ([[User talk:Janhrach|talk]]) 18:17, 12 June 2025 (UTC)
:::::Yes, he has, thanks for asking @[[User:Janhrach|Janhrach]] [[User:Julius Schwarz|Julius Schwarz]] ([[User talk:Julius Schwarz|talk]]) 20:18, 12 June 2025 (UTC)
:::::@[[User:Janhrach|Janhrach]] Maybe the changes made to [[Module:European and national party data/Wd]] can be useful to [[Module:Wd]]? [[User:Julius Schwarz|Julius Schwarz]] ([[User talk:Julius Schwarz|talk]]) 20:19, 12 June 2025 (UTC)
::::::Maybe. I have some work to do in the sandbox, which I want to finish before I start doing anything else related to this module. [[User:Janhrach|Janhrach]] ([[User talk:Janhrach|talk]]) 13:36, 15 June 2025 (UTC)
:@[[User:Julius Schwarz|Julius Schwarz]] For the first case, are you trying to output the date in that format? If so, as long as the input date is the raw "1992-11-10" or in English, you could set up the code to run the date through something like <source lang=lua inline>lang:formatDate( i18n.fullDate, '1992-11-10')</source> and then, for Spanish, set <code>i18n.fullDate = 'n \\d\\e F \\d\\e Y'</code>. <span class="nowrap">--[[User:Ahecht|Ahecht]] ([[User talk:Ahecht|<b style="color:#FFF;background:#04A;display:inline-block;padding:1px;vertical-align:middle;font:bold 50%/1 sans-serif;text-align:center">TALK<br />PAGE</b>]])</span> 14:14, 9 June 2025 (UTC)
::Thanks a lot, @[[User:Ahecht|Ahecht]]. In the meantime, a Spanish contributor, @[[User:Leoncastro|Leoncastro]], helped out [https://en.wikipedia.org/w/index.php?title=Module:European_and_national_party_data/Wd&action=history here] and [https://en.wikipedia.org/w/index.php?title=Module:European_and_national_party_data/Wd/i18n&action=history here], in case you want to have a look! [[User:Julius Schwarz|Julius Schwarz]] ([[User talk:Julius Schwarz|talk]]) 14:37, 9 June 2025 (UTC)
:::PS: @[[User:Ahecht|Ahecht]], would you know how to hard-code a plural for the currency, by any chance? [[User:Julius Schwarz|Julius Schwarz]] ([[User talk:Julius Schwarz|talk]]) 18:34, 9 June 2025 (UTC)
::::@[[User:Julius Schwarz|Julius Schwarz]] If you modify your module to do two calls to [[Module:Wd]], one with the <code>raw</code> flag and one with the <code>data</code> flag, you can then do something like <source lang=lua inline>if amount > 1 then unit = unit .. 's' end</source> (and you would then have an override for languages such as Swedish where the plural of 'krone' is 'kroner'). I suppose you could also I did update [[Module:European and national party data/sandbox]] so that you can request the unit from <code>allpp_get_data()</code> or <code>xlate_wikidata()</code>. <span class="nowrap">--[[User:Ahecht|Ahecht]] ([[User talk:Ahecht|<b style="color:#FFF;background:#04A;display:inline-block;padding:1px;vertical-align:middle;font:bold 50%/1 sans-serif;text-align:center">TALK<br />PAGE</b>]])</span> 20:53, 9 June 2025 (UTC)
:::::Thanks @[[User:Ahecht|Ahecht]]. [https://en.wikipedia.org/w/index.php?title=Module%3AEuropean_and_national_party_data%2Fsandbox&diff=1294906871&oldid=1294792449 First time] not lucky :D Did I get your <code>unit=yes/no</code> right? [[User:Julius Schwarz|Julius Schwarz]] ([[User talk:Julius Schwarz|talk]]) 14:28, 10 June 2025 (UTC)
::::::@[[User:Julius Schwarz|Julius Schwarz]] I don't have time to debug your code, but I think you need to specify <code>raw=yes</code> to get it without the unit. When I uncomment the 2nd-to-last line of the module (the one that exports xlate_wikidata) and run <source lang=lua inline>=p.xlate_wikidata('property', 'Q950179', 'P12919', '', '', '', '', '', '', 'unit=yes')</source> in the console it returns <code>euro</code> and when I do <source lang=lua inline>=mw.getContentLanguage():formatNum(tonumber(p.xlate_wikidata('property', 'Q950179', 'P12919', '', '', '', '', 'raw=yes', '', '')))</source> it returns <code>171,460.56</code>. <span class="nowrap">--[[User:Ahecht|Ahecht]] ([[User talk:Ahecht|<b style="color:#FFF;background:#04A;display:inline-block;padding:1px;vertical-align:middle;font:bold 50%/1 sans-serif;text-align:center">TALK<br />PAGE</b>]])</span> 15:10, 10 June 2025 (UTC)
:::::::Thanks @[[User:Ahecht|Ahecht]]. I will check it out and try and fix it. I guess what I was trying to say is that I am not really sure how the "unit" bit works. [[User:Julius Schwarz|Julius Schwarz]] ([[User talk:Julius Schwarz|talk]]) 20:18, 10 June 2025 (UTC)
:::::::@[[User:Ahecht|Ahecht]] second time almost lucky! That did help, but somehow we lose the thousand delimiter in the process :S [[User:Julius Schwarz|Julius Schwarz]] ([[User talk:Julius Schwarz|talk]]) 09:31, 11 June 2025 (UTC)
::::::::@[[User:Julius Schwarz|Julius Schwarz]] The <code>mw.getContentLanguage():formatNum(tonumber())</code> part above around the raw currency amount should fix that. <span class="nowrap">--[[User:Ahecht|Ahecht]] ([[User talk:Ahecht|<b style="color:#FFF;background:#04A;display:inline-block;padding:1px;vertical-align:middle;font:bold 50%/1 sans-serif;text-align:center">TALK<br />PAGE</b>]])</span> 13:15, 11 June 2025 (UTC)
:::::::::@[[User:Ahecht|Ahecht]] took a bit of tinkering but I think it is working, thanks a lot! [[User:Julius Schwarz|Julius Schwarz]] ([[User talk:Julius Schwarz|talk]]) 13:26, 11 June 2025 (UTC)
== Seeking most recent value ==
When seeking a value such as a population via this template, Wikidata will often have multiple values with different {{wpl|585}} qualifiers. Sometimes the most recent one will be given a preferred rank but sometimes not. Is there any way to ask it to retrieve the most recent one? I don't think (?) the future/current/former flags can work for this, both because they rely only on {{wpl|580}}/{{wpl|582}}, not on {{wpl|585}}, and because even if they did, the most recent value would just be one instance of a former value and wouldn't be prioritized if the other happened to be listed first.
I [[Module_talk:Wd/Archive_1#Seeking_newest_value,_rather_than_current_value|asked about this a few years ago]] and @[[User:Thayts|Thayts]] mentioned something in the works; has there been progress on it? <span style="border:3px outset;border-radius:8pt 0;padding:1px 5px;background:linear-gradient(6rad,#86c,#2b9)">[[User:Sdkb|<span style="color:#FFF;text-decoration:inherit;font:1em Lucida Sans">Sdkb</span>]]</span> <sup>[[User talk:Sdkb|'''talk''']]</sup> 22:37, 28 July 2025 (UTC)
== Specifying URL alive/dead status ==
Citations with archive URLs are displayed differently when the URL is specified as alive via {{para|url-status|live}} vs. when it's specified as dead or not specified (see first paragraph of [[Help_talk:Citation_Style_1#Treating_all_references_as_dead_by_default|here]]). Would it be possible to create a way for this template to likewise specify URL status? <span style="border:3px outset;border-radius:8pt 0;padding:1px 5px;background:linear-gradient(6rad,#86c,#2b9)">[[User:Sdkb|<span style="color:#FFF;text-decoration:inherit;font:1em Lucida Sans">Sdkb</span>]]</span> <sup>[[User talk:Sdkb|'''talk''']]</sup> 00:22, 29 July 2025 (UTC)
:Yes, maybe sometime in the future, but it is not supported right now. [[User:Janhrach|Janhrach]] ([[User talk:Janhrach|talk]]) 16:20, 7 August 2025 (UTC)
== Handling of Wikidata refs - empty titles and missing properties ==
We have a problem on cywiki where we have pages taking references from Wikidata. In 2023, @[[User:Janhrach|Janhrach]] very kindly forked the code and applied some additional handling to prevent visible errors. Time moves on and the code in the module has been refactored. I applied this version but it shows errors again - see https://cy.wikipedia.org/wiki/8_Mile
I would like to keep the module up-to-date, so I had various attempts to re-apply the previous fix - but as variables have changed, it's quite tricky. There are also some more significant errors regarding those properties such as Rotten Tomatoes and Meta Critic, which is potentially easier to fix. Is there a possibility of handling this in an easier way? I would prefer not to put in special handling just for us as it limits future updates, but it would be good to know what's feasible. I could revert my changes to what was working, but I suspect that I would also need to revert other updates to Citation/CS1 modules as well. Thank you. [[User:Dafyddt|Dafyddt]] ([[User talk:Dafyddt|talk]]) 22:42, 22 August 2025 (UTC)
:Regarding the specific errors you have mentioned, the problem was that Wikidata says that references citing online databases need to contain both {{prop|248}} and a property of the {{mono|External identifier}} data type, while the references causing errors contained only the latter. This may seem like a minor technicality, but database references are handled by an ugly hack in the module, and I do not want to make this hacky code more complicated to support references like this. I plan to fix this issue by creating a separate template for citing database references; this will hopefully also eliminate cryptic error messages like these.
:As for re-introducing the cywiki fix, the old code is probably of little use, because the code has changed quite a lot. If it is really needed, I can try to reimplement it, but I would strongly prefer if you waited until I make the fix I have mentioned in the previous paragraph.
:Also, regarding the changes <u>to this module</u> since I made the cywiki fix, there were two of them that are especially relevant here:
:* I added verbose error messages. They should mostly be comprehensible after reading the documentation. I agree though that the errors you have mentioned are hard to understand; I will fix that.
:* {{mono|1={{!}}title=}} is no longer a mandatory param for {{tl|Cite web}}. In practice, this means that missing titles in references do not cause errors in this module, but in the citation template, like you see in the article you have linked. This hopefully made the errors more understandable. When I create the database-citation template, many of these missing-title errors could be eliminated.
:—[[User:Janhrach|Janhrach]] ([[User talk:Janhrach|talk]]) 14:19, 26 August 2025 (UTC)
::{{tq|{{mono|1={{!}}title=}} is no longer a mandatory param for {{tl|Cite web}}.}} False. I don't know where you got that idea but you are mistook. {{para|title}} {{em|is}}, and likely will always be, required by {{tld|cite web}}. If you have found some place where it is stated that {{para|title}} is {{em|not}} required, name that place so that it can be visited and fixed.
::—[[User:Trappist the monk|Trappist the monk]] ([[User talk:Trappist the monk|talk]]) 14:40, 26 August 2025 (UTC)
:::I meant that ''this module'' does not consider it mandatory. I wrote that {{tq|this means that missing titles in references do not cause errors in this module, but in the citation template[...]}} [[User:Janhrach|Janhrach]] ([[User talk:Janhrach|talk]]) 14:43, 26 August 2025 (UTC)
::::Yes, I saw that, but your initial declaration that {{para|title}} is not required by {{tlx|cite web}} is false. That declaration cannot be allowed to stand unchallenged.
::::—[[User:Trappist the monk|Trappist the monk]] ([[User talk:Trappist the monk|talk]]) 14:52, 26 August 2025 (UTC)
:::::I should have made it clear that I refered to ''my'' changes to ''this'' module. I now see that {{tq|changes since I made the cywiki fix}} could have been interpreted as including changes to CS1. [[User:Janhrach|Janhrach]] ([[User talk:Janhrach|talk]]) 14:59, 26 August 2025 (UTC)
|