Help talk:Lua

From Wikidata
Jump to navigation Jump to search

How to use Wikidata country data in a Wikipedia Lua template?

[edit]

Hi, I'm trying to reimplement w:Template:Flagicon on Lua just for the fun of it - see the small announcement. There is a table where images of flags in Commons are identified with the article of their territory in the project where the module is hosted: w:Module:Sandbox/QuimGil/FlagTranslations. Could Wikidata help here?

For instance at Q228 we have all the ISO codes related to "Andorra", the flag image and the translations in all Wikimedia projects. It would be amazing if this data could be leveraged. Maybe not for each template query (that could be expensive) but at least to populate and maintain those local tables automatically. The master table would be the only one maintained manually and all it would do is to state that "Andorra" = Q228, "Berlin" = Q64...

Even that master table could be highly automated one day because we do have the ISO 3166 entries etc in Wikidata... but let's go step by step.  :) --Qgil (talk) 18:42, 3 June 2013 (UTC)[reply]

Well, no, not yet, but that is planned. There is an limitation in WikibaseClient (the client extension of Wikidata), that only pulls claims from an item that is linked to that particular page. So, for example, the only page on the English Wikipedia where you can pull the ISO 3166 entries about Andorra from Wikidata is w:Andorra.--Snaevar (talk) 18:28, 4 June 2013 (UTC)[reply]
Ok, thank you! Good to know. Is there a specific bug report or wiki page to watch and follow the progress in the development of this feature?--Qgil (talk) 18:47, 4 June 2013 (UTC)[reply]
bugzilla:47930 (Sorry I wasn't sure if this also applies to Lua but it does.) --Lydia Pintscher (WMDE) (talk) 15:41, 5 June 2013 (UTC)[reply]

Item id lookup?

[edit]

Is there a way to look up an item id from a language code and article title, like Special:ItemByTitle does (sample: "en" + "Arctic" => Q25322)?

I'd like to check a series of pages and see if there is an item available. --  Docu  at 15:26, 13 August 2013 (UTC)[reply]

Can you explain a bit more specifically what you are trying to do? --Lydia Pintscher (WMDE) (talk) 15:33, 13 August 2013 (UTC)[reply]


rm Wikipedia has some 4000 articles. I'd like to figure out which ones don't have items yet.
A simple way could be look them up in sets of 500, e.g. *{{#invoke:LuaItemByTitle|rm|Alfons Tuor}} => Q14565844
Maybe I'd better try to do this in python by bot? --  Docu  at 15:46, 13 August 2013 (UTC)[reply]
http://toolserver.org/~holek/misc/no-interwiki.php?db=rmwiki_p&category=&method=D&sort=A&format=normal
answers my question (seems that I created most of the remaining ones yesterday), but I'm sure that there would be another application for this feature. --  Docu  at 08:51, 14 August 2013 (UTC)[reply]

Help with Module

[edit]

Hello. I need help for Module. el:Module:Περισσότερεςκατακτήσεις (is in English).

See Cypriot First Division (Q155965), property winner (P1346), qualifier number of wins (P1355). I want to show the item of P1346 if it has the largest qualifier P1355. Xaris333 (talk) 00:00, 27 November 2016 (UTC)[reply]

Lua error

[edit]

{{Property documentation}} produces:

"Lua error in Module:Property_documentation at line 721: attempt to compare nil with number."

See: Property talk:P6828 and Property talk:P6829. --Kolja21 (talk) 22:16, 8 June 2019 (UTC)[reply]

Hopefully fixed. Please report to Template talk:Property documentation next time. --Matěj Suchánek (talk) 08:33, 9 June 2019 (UTC)[reply]