| Module:Wd is indefinitely protected from editing as 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: 3 months |
| 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. |
| Text or other creative content from this version of Module:Wd was copied or moved into Module:European and national party data/Wd with this edit on 22 May 2025. The former page's history now serves to provide attribution for that content in the latter page, and it must not be deleted as long as the latter page exists. |
We have a problem on cywiki where we have pages taking references from Wikidata. In 2023, @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. Dafyddt (talk) 22:42, 22 August 2025 (UTC)
|title= is no longer a mandatory param for {{Cite web}}.False. I don't know where you got that idea but you are mistook.
|title= is, and likely will always be, required by {{cite web}}. If you have found some place where it is stated that |title= is not required, name that place so that it can be visited and fixed.this means that missing titles in references do not cause errors in this module, but in the citation template[...]Janhrach (talk) 14:43, 26 August 2025 (UTC)
|title= is not required by {{cite web}} is false. That declaration cannot be allowed to stand unchallenged.changes since I made the cywiki fixcould have been interpreted as including changes to CS1. Janhrach (talk) 14:59, 26 August 2025 (UTC)
Hello, could we have more customization on Language label? I mean the part when code constructs cite web etc. I see it uses aliasesP.language which means for Q1860 it picks "English". Maybe we could "tell" in i18n configuration to return value of ISO 639-1 or even P424 if that language has it, of course we always fallback to aliasesP.language. This issue comes from my local wiki, for example Module is returning label in cite web that is giving CS1 error unrecognized language. Zygimantus (talk) 13:00, 28 August 2025 (UTC)
getReferenceDetails/getReferenceDetail to make using getValue optional (replacable with alternatives). This could also be used to make handling of author params more flexible. Janhrach (talk) 19:17, 18 March 2026 (UTC)If a WD property value has multiple references and you enclose the returned template value in <ref></ref> you end up with just one reference rather than multiple. For example, the elevation property value for Mount Robson (Q1161258) has two references but it ends up showing as a single reference but with both sources given in the one reference which is not ideal and technically incorrect as they should be displayed as separate references.
i.e.
The elevation of [[Mount Robson]] is {{Wikidata|property|raw|Q1161258|P2044}} metres.<ref>{{Wikidata|references|raw|Q1161258|P2044}}</ref>
The elevation of Mount Robson is 3954 metres.[1]
Do I have to write a module that takes the output from {{Wikidata}} and wrap each citation with separate <ref></ref> or is there a template parameter that will do this for me? RedWolf (talk) 01:11, 22 October 2025 (UTC)
{{Wikidata|references|raw|Q1161258|P2044}}
{{Wikidata|references|Q1161258|P2044}}
References
Was just looking at this module and the possibility of using it to pull some data in from Wikidata, only to notice it doesn't handle language code fallback for English language variants (the only workaround is setting 'multilanguage' which will pull in text in any language). Just documenting my investigation/possible solution.
Specifically, we've currently got this at line 879:
elseif datatype == 'monolingualtext' then
if anyLang or datavalue['language'] == self.langCode then
return datavalue['text']
else
return nil
This will work (on English Wikipedia) if the text is in 'en' but not if it is in 'en-gb' or 'en-ca'.
When setting up the configuration object, we could add something like:
cfg.subLangCodes = {}
if cfg.langCode == "en" then
cfg.subLangCodes = {["en-ca"] = true, ["en-gb"] = true}
end
Then when we're retrieving text values, we could do something like this. (My Lua might be a bit rusty...)
elseif datatype == 'monolingualtext' then
if anyLang or datavalue['language'] == self.langCode or self.subLangCodes[datavalue['language']] then
return datavalue['text']
else
return nil
That way we'd not return a nil when there's a valid Canadian or British English text, with nothing else.
Other options — There's a bunch of other things we could also do...
Kind of a silly one, but worth noting - if the page has {{Use British English}} (or even {{Use Oxford spelling}}), we could prioritise the en-gb value over the other variants, and if it has {{Use Canadian English}}, we could prioritise the en-ca text, otherwise grab 'en' if it exists, or en-gb/en-ca if it doesn't. (All the other English variants—American, Australian, New Zealand, Indian, Nigerian etc.—don't have their own ISO 639-3 code, or recognition in the mw.language API, as far as I can tell.)
More importantly, and in terms of how to make this language-agnostic (so it could be used on other wikis with language codes - perhaps pt with pt-br), the mw.language API that's exposed in Lua does let you lookup fallbacks from the specific to the more general (i.e. mw.language.getFallbacksFor("pt-br", mw.language.FALLBACK_STRICT) returns a table containing 'pt'), but it doesn't seem to have a function for identifying sub-language codes from the base language (also, outside of English and Portuguese, you've got stuff like Slovak and Czech where each one call back to each other... or the complexity of the fallback graphs around Russian and Arabic and so on as visualised here).
To abstract away the language fallback stuff, maybe it could be a module in Lua that pulls the data from fallback language data and makes it available for contexts like this.
This all seems quite complicated and given we're on English Wikipedia, and Wikidata doesn't have the ability to use a whole bunch of non-ISO languages like Jamaican Creole English etc., handling the British/Canadian English variants seems like a pragmatic solution. If other wikis are reusing the code, maybe that could be solved later? Thoughts? —Tom Morris (talk) 16:54, 18 March 2026 (UTC)
en-gb) and "Y" (tagged en-ca). You prefer Canadian English, so you prefer retrieving the name tagged en-ca. However, when you call getValue (the function you propose modifying), you call it on each of the names separately, not all of the names at once.getValue gets "X" (tagged en-gb) as an argument, but it knows you would prefer an en-ca name if it exists. However, getValue doesn't know if a en-ca name exists; it has to return "X".State:iterate (line 2221).Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.