Template talk:Departments of France

From OpenStreetMap Wiki
Jump to navigation Jump to search

Hide links with CSS

Since Andrew has created this wonderful new {languages} template, I thought that idea could maybe be transferred to other templates with expensive parser functions. Turns out it works quite well: User:Charel/Test. I think we should rework the current template in that way. Cheers, Charel (talk) 00:43, 3 May 2016 (UTC)

In fact it was copy-pasted from Commons, where I created it several years ago..., I updated it to make it work really here. Then a few other similar templates were created on Commons for other countries, and I created a few others (e.g. for Germany, US), or corrected on Commons those that were actually not working.
If you are speaking about the Languages template, I was also the main author to make it work in the current version. Initially there was not a lot of languages but it was the start that alowed this wiki to be much more translated. Then came the parser limit and Andrew proposed changes. I also updated small things to make it work also on mobiles, and solve some problems and synchronize it so that it works really like the current template.
The solution based on CSS could not be developed initially (it required changes to the global CSS of this wiki and initially it was not possible before that template was widely tested, understood and used.
However there's still a ptoblem on this wiki because there's a global Javascript that has a bug and that uses an old deprecated Javascript API of MediaWiki. I've proposed the change using jQuery and compatible with MediaWiki "loader" implemented 3 years ago. But this changed is still not applied on this wiki.
Anyway, I know that this templates uses #ifexist (not a problem on Commons whose parser functions have a higher limit: 100 calls on this wiki, 200 on Commons, and Commons runs on much better performing servers). Commons has no problems with #ifexist which generates directly thye intended display without needing tricky CSS or any Javascript. In Commons #ifexist may be enabled or not with such navbox (the template works in two modes depending on parameter "all=1" or not: the mode with all=1 generates all links (including redlinks) and is useful in a parent category or page for creating subcategories or pages. without all=1 only the existing pages are displayed using #ifexist, and it is the default mode for inclusion in children pages or categories.
Verdy_p (talk) 06:56, 3 May 2016 (UTC)
Hi, this wasn't meant as an offense. I've seen that you are very active since a long time on this wiki and added lots of bitterly needed templates (The actual {languages} template, as you mentioned, being a prime example). I'm also aware that the "CSS solution" is only possible since the addition of the needed codes. But since we don't have Commons servers, I think it's a smart solution (even if it smells a bit 'hacky' :)). Btw, thanks for explaining the "all" parameter, I included that now. I'm also wondering if the "overseas" parameter would still be needed if we wouldn't be limited by the parser function uses any more?
For now I am waiting on that Departments template. It works as is on a limited number of pages and the red links (with all=1) are not a problem (they help creating the missing articles with a coherent naming). Without all=1 it tests existing pages that have used other naming conventions, and that needed redirects to work. the #ifexist is a tool for building pages and finding them. If the set is complete, we could run with all=1 always (but hiding red links will not be a good idea).
For the languages bar, hiding red links makes sens as there's (normally) no confusion on the naming convention (but we've seen often that these conventions were not followed and we still need many fixes).
The new languages bar is useful only on a few tested pages where all broken links have now been resolved (Main page, Category:Categories, ...)
It works this way to avoid breakign pages while cleanup and corrections are in progress.
Ideally we could extend the limit to 200 calls to "expensive parser calls" instead of 100 (#ifexist is in fact not so expensive, it could have been expensive in the old days of MediaWiki, but no longer; it could cause expesive usages, not because of #ifexist, but because it may be used to *transclude* many complex templates: the cost is in in the inclusion size and number of parsed nodes, but the MediaWiki parser has also evolved and has a cache for expanding templates only once if they use the same set of parameters). MediaWiki offers another way to check expensive pages that use too many transclusions (this is the real cost).
For this reason Commons (and Wikipedias) had no problem when it extended the limit from 100 to 200 (which is a much better limit that allows creating useful navboxes).
There's a more urgent need to find a way to solve #ifexist in {{Tag}} or {{Key}} in translations of tags documentation (there's a limit on the number of translated link targets, when it is reached, these templates will link to the English page only). — Verdy_p (talk) 13:45, 3 May 2016 (UTC)