Module talk:Wd: Difference between revisions

Content deleted Content added
Line 120:
::::@[[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)