Template talk:Institution/2017

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Wikidata use for the name parameter[edit]

This template will certainy need a total rewrite but we can probably start with defaulting the name to parameter to {{label|{{{wikidata}}}}} (can't do it, lost my admin rights). --Zolo (talk) 08:34, 8 March 2017 (UTC)[reply]

@Zolo: you can edit Template:Institution/sandbox with your proposed changes and use {{Edit protected}}. Multichill (talk) 21:43, 8 March 2017 (UTC)[reply]
@Multichill: ok did it. While I was at it, I also added Wikidata for other parameters, see Template talk:Institution/sandbox. That should work, but without Lua the code feels rather intricated "homecat" parameter.
In terms of performance, using Wikidata unsurprisingly requires more memory. For the Rijksmuseum that's 8.6 Mb instead of 4.6 Mb when used in the institution namespace, and 5.8 instead of 3.6 mb in another namespace (limit is 50 Mb per page). --Zolo (talk) 11:49, 9 March 2017 (UTC)[reply]
I tried your proposed edits and there is an issue, see for example:
{{Institution/sandbox
 |name        =
 |native name =
 |location    =
 |latitude    =
 |longitude   =
 |established =
 |website     =
 |image       =
 |homecat     =Van Abbemuseum
 |linkback    =Institution:Van Abbemuseum
 |authority   =
 |wikidata    =Q1782422
}}

which shows:

institution QS:P195,Q1782422

I was hoping that the new code will fetch the missing fields but it does not. I think that the issue is that you have to use {{#if:{{{1|}}}|{{{1}}}|{{data|property=...|item=...}} }} syntax instead of {{{1|{{data|property=...|item=...}} }}}. Most Institution templates have the field names just not the values. --Jarekt (talk) 14:32, 9 March 2017 (UTC)[reply]

Oh yes, it does not work if the parameter name is added added to the template but left blank... I added the "if" for the name parameter, but doing it for all parameters will make the code all but unreadable. I'll rather try to rewrite it in Lua, I see you have already tried {{Creator}}. --Zolo (talk) 15:25, 9 March 2017 (UTC)[reply]
LUA would be much better, but I'm quite the newbie when it comes to LUA. Some time ago I made Phab:T89599 and phab:T89597 to keep track of this conversion. Multichill (talk) 17:06, 9 March 2017 (UTC)[reply]

Lua version[edit]

(spin off of the thread above)

Ok, I started Module:Institution. It seems relatively straightforward, but it may take a while to make it suitable for deployment. --Zolo (talk) 20:49, 9 March 2017 (UTC)[reply]
In Template:Institution/layout, I see a "stub label" parameter that does not seem to be usable from anywhere, can I get rid of it ? --Zolo (talk) 21:04, 9 March 2017 (UTC)[reply]
@Jarekt: [1]? Does seem to be used, see Category:Institution template stubs. I don't think we need that one when we start using Wikidata. Multichill (talk) 14:28, 10 March 2017 (UTC)[reply]
If stubs have q-code and they can pull stuff of wikidata than they should not be stubs anymore. The remaining ones we might just need to delete. There were over a 1000 stubs at some point and it seems like we are down to 400 and all I tried had a q-code, so I think we are in a good shape. Zolo can you base your module on Module:Creator? the templates were almost identical at some point and it would be easier to maintain if the modules are as well. I really need to finish and roll out Module:Creator. --Jarekt (talk) 15:03, 10 March 2017 (UTC)[reply]
Ok I think I now have a working Lua version, but I could use help with testing and moving translations to Module:I18n/institution. Note that categorization is namespace dependent, may need more tests in the institution and category namespaces.
Everything should work as in the current version, except that it does not add Category:Institution templates with authority control data and Category:Categories with authority control data. This categories are currently added through {{Authority control}}, that might make sense to handle it through Module:Authority control.
I have reused Module:Creator, including some functionalities that do not appear needed for "institution" at the moment. But I made a few changes, most notably:
  • I created a table containing parameters passed from the Wikitext, their equivalent Wikidata value, their default "demo" value and the category to be added when the parameter is missing. I found it easier to work with, especially for adding maintenance categories, which are rather numerous. This way we can also more easily add tracking categories to see which parameters come from Wikidata.
  • the args variable containing arguments coming from the Wikitext and others is defined at the module level rather than the function level. parameters containing only empty string are discarded. It means that the demo parameter should be using this way "|demo = true " rather than just "|demo = ". I think that's more intuitive, and that matches the way parameters behave most of the time in Wiki templates.
@Multichill the "stub" parameter is used but I don't see the any use of the "stub label" parameter. Anyway, with Wikidata inside, we should indeed probably get rid of the whole "sub" thing. For example with {{Institution/lua}}, Institution:Santo Spirito, Florence does not look at all like a stub. --Zolo (talk) 10:17, 11 March 2017 (UTC)[reply]
Good job! Probably add some tests to Template:Institution/testcases to see if everything works and at some point swap this template. Probably need to baby sit it after the swap to debug any problems. Multichill (talk) 18:18, 11 March 2017 (UTC)[reply]


I added tests at Template:Institution/testcases. A few remarks:

  1. Image size in the Lua version is that of Template:Creator, which is a bit smaller than that of template:Institution. Not sure which is better.
  2. Image size is set through an imagesizeparameter in the current template. The Lua version uses imgwidth. Not sure which is better either, but we should probably have the same parameter for creators and institutions. Note that the current imagesize parameter does not properly works for all languages, as it is only passed in the English version of the template.
  3. bullet lists are broken (both in the current template and in the Lua version).
  4. Template:Creator adds substantially html ids and classes than the institution template. Perhaps we should add more for institution, though I am not very clear about the practical use. --Zolo (talk) 10:18, 12 March 2017 (UTC)[reply]
Update Template:Institution/lang and it actually contains more than 40 languages. @Multichill: I seem to remember you were active on translatewiki, it might be worth moving it there ? I suspect "Coordinates" and "Website" are already there but I don't know how to look for them. --Zolo (talk) 08:38, 13 March 2017 (UTC)[reply]