Category talk:Proto-Niger-Congo language

From Wiktionary, the free dictionary
Jump to navigation Jump to search

@Benwing2, any idea why autocat is failing here? —Μετάknowledgediscuss/deeds 17:16, 13 July 2021 (UTC)[reply]

@Metaknowledge It's hitting the template expansion limit due to the huge number of daughter languages. This happens when trying to create the family tree diagram for all the languages. If you go to Category:Proto-Atlantic-Congo language and click "Show preview" and then open up "Parser profiling data" at the bottom, you can see the "Post-expand include size" is listed as 2,022,419/2,097,152 bytes, i.e just barely under the limit, and since Proto-Niger-Congo has even more daughters, it goes over the limit. To fix this, either:
  1. Make the template code that's generated be more efficient. There are various ways to do that, see below;
  2. Have a param to not display the family tree at all, and use it here;
  3. Have a param to prune certain subtrees from the family tree (e.g. Bantu languages, which you can view at Category:Proto-Bantu language).

In terms of making the code more efficient: The generated code for e.g. Old High German looks like this: <div class="familytree"><ul><li><span class="familytree-lang" >[[:Category:Old High German language|Old High German <span class="familytree-code">(goh)</span>]]</span><span class="familytree-toptoggle mw-customtoggle-familytree1" style="display: none;">Collapse</span><ul class="mw-collapsible" id="mw-customcollapsible-familytree1" data-expandtext="Expand" data-collapsetext="Collapse"><li><span class="familytree-linedrawing">└<span class="familytree-toggle mw-customtoggle-familytree2">───┬</span></span> <span class="familytree-lang" >[[:Category:Middle High German language|Middle High German <span class="familytree-code">(gmh)</span>]]</span><ul class="mw-collapsible" id="mw-customcollapsible-familytree2" data-expandtext="[+]─" data-collapsetext="[-]┬"><li><span class="familytree-linedrawing">    ├<span class="familytree-toggle mw-customtoggle-familytree3">───┬</span></span> <span class="familytree-lang" >[[:Category:Alemannic German language|Alemannic German <span class="familytree-code">(gsw)</span>]]</span><ul class="mw-collapsible" id="mw-customcollapsible-familytree3" data-expandtext="[+]─" data-collapsetext="[-]┬"><li><span class="familytree-linedrawing">    │   ├<span class="familytree-branch">────</span></span> <span class="familytree-lang" >[[:Category:Colonia Tovar German language|Colonia Tovar German <span class="familytree-code">(gct)</span>]]</span></li><li><span class="familytree-linedrawing">    │   └<span class="familytree-toggle mw-customtoggle-familytree4">───┬</span></span> <span class="familytree-lang" >[[:Category:Swabian language|Swabian <span class="familytree-code">(swg)</span>]]</span><ul class="mw-collapsible" id="mw-customcollapsible-familytree4" data-expandtext="[+]─" data-collapsetext="[-]┬"><li><span class="familytree-linedrawing">    │       └<span class="familytree-branch">────</span></span> <span class="familytree-lang" >[[:Category:Sathmar Swabian language|Sathmar Swabian <span class="familytree-code">(gmw-stm)</span>]]</span></li></ul></li></ul></li><li><span class="familytree-linedrawing">    ├<span class="familytree-toggle mw-customtoggle-familytree5">───┬</span></span> <span class="familytree-lang" >[[:Category:Bavarian language|Bavarian <span class="familytree-code">(bar)</span>]]</span><ul class="mw-collapsible" id="mw-customcollapsible-familytree5" data-expandtext="[+]─" data-collapsetext="[-]┬"><li><span class="familytree-linedrawing">    │   ├<span class="familytree-branch">────</span></span> <span class="familytree-lang" >[[:Category:Cimbrian language|Cimbrian <span class="familytree-code">(cim)</span>]]</span></li><li><span class="familytree-linedrawing">    │   ├<span class="familytree-branch">────</span></span> <span class="familytree-lang" >[[:Category:Gottscheerish language|Gottscheerish <span class="familytree-code">(gmw-gts)</span>]]</span></li><li><span class="familytree-linedrawing">    │   ├<span class="familytree-branch">────</span></span> <span class="familytree-lang" >[[:Category:Hutterisch language|Hutterisch <span class="familytree-code">(geh)</span>]]</span></li><li><span class="familytree-linedrawing">    │   └<span class="familytree-branch">────</span></span> <span class="familytree-lang" >[[:Category:Mòcheno language|Mòcheno <span class="familytree-code">(mhn)</span>]]</span></li></ul></li><li><span class="familytree-linedrawing">    ├<span class="familytree-toggle mw-customtoggle-familytree6">───┬</span></span> <span class="familytree-lang" >[[:Category:Central Franconian language|Central Franconian <span class="familytree-code">(gmw-cfr)</span>]]</span><ul class="mw-collapsible" id="mw-customcollapsible-familytree6" data-expandtext="[+]─" data-collapsetext="[-]┬"><li><span class="familytree-linedrawing">    │   ├<span class="familytree-branch">────</span></span> <span class="familytree-lang" >[[:Category:Hunsrik language|Hunsrik <span class="familytree-code">(hrx)</span>]]</span></li><li><span class="familytree-linedrawing">    │   └<span class="familytree-branch">────</span></span> <span class="familytree-lang" >[[:Category:Transylvanian Saxon language|Transylvanian Saxon <span class="familytree-code">(gmw-tsx)</span>]]</span></li></ul></li><li><span class="familytree-linedrawing">    ├<span class="familytree-branch">────</span></span> <span class="familytree-lang" >[[:Category:East Central German language|East Central German <span class="familytree-code">(gmw-ecg)</span>]]</span></li><li><span class="familytree-linedrawing">    ├<span class="familytree-branch">────</span></span> <span class="familytree-lang" >[[:Category:East Franconian language|East Franconian <span class="familytree-code">(vmf)</span>]]</span></li><li><span class="familytree-linedrawing">    ├<span class="familytree-toggle mw-customtoggle-familytree7">───┬</span></span> <span class="familytree-lang" >[[:Category:German language|German <span class="familytree-code">(de)</span>]]</span><ul class="mw-collapsible" id="mw-customcollapsible-familytree7" data-expandtext="[+]─" data-collapsetext="[-]┬"><li><span class="familytree-linedrawing">    │   └<span class="familytree-branch">────</span></span> <span class="familytree-lang" >[[:Category:Unserdeutsch language|Unserdeutsch <span class="familytree-code">(uln)</span>]]</span></li></ul></li><li><span class="familytree-linedrawing">    ├<span class="familytree-branch">────</span></span> <span class="familytree-lang" >[[:Category:Luxembourgish language|Luxembourgish <span class="familytree-code">(lb)</span>]]</span></li><li><span class="familytree-linedrawing">    ├<span class="familytree-toggle mw-customtoggle-familytree8">───┬</span></span> <span class="familytree-lang" >[[:Category:Rhine Franconian language|Rhine Franconian <span class="familytree-code">(gmw-rfr)</span>]]</span><ul class="mw-collapsible" id="mw-customcollapsible-familytree8" data-expandtext="[+]─" data-collapsetext="[-]┬"><li><span class="familytree-linedrawing">    │   ├<span class="familytree-branch">────</span></span> <span class="familytree-lang" >[[:Category:Pennsylvania German language|Pennsylvania German <span class="familytree-code">(pdc)</span>]]</span></li><li><span class="familytree-linedrawing">    │   └<span class="familytree-branch">────</span></span> <span class="familytree-lang" >[[:Category:Volga German language|Volga German <span class="familytree-code">(gmw-vog)</span>]]</span></li></ul></li><li><span class="familytree-linedrawing">    ├<span class="familytree-branch">────</span></span> <span class="familytree-lang" >[[:Category:Vilamovian language|Vilamovian <span class="familytree-code">(wym)</span>]]</span></li><li><span class="familytree-linedrawing">    ├<span class="familytree-branch">────</span></span> <span class="familytree-lang" >[[:Category:Yeniche language|Yeniche <span class="familytree-code">(yec)</span>]]</span></li><li><span class="familytree-linedrawing">    ├<span class="familytree-branch">────</span></span> <span class="familytree-lang" >[[:Category:Yiddish language|Yiddish <span class="familytree-code">(yi)</span>]]</span></li><li><span class="familytree-linedrawing">    └<span class="familytree-branch">────</span></span> <span class="familytree-lang" >[[:Category:Zipser German language|Zipser German <span class="familytree-code">(gmw-zps)</span>]]</span></li></ul></li></ul></li></ul></div><templatestyles src="Module:family tree/style.css"></templatestyles> The obvious places to make this more efficient are replacing the &nbsp; with an actual NBSP char and shortening the CSS class and ID names. @Erutuon Can you help here? Is it possible to replace ID's like "mw-customcollapsible-familytree7" with something much shorter? I don't really know what the ID does or how it works. Similarly, it seems like everywhere that has the word familytree could be replaced e.g. with ft, although I can't see where classes like familytree-branch are defined; not in MediaWiki:Common.css, for example. Benwing2 (talk) 01:06, 14 July 2021 (UTC)[reply]

@Benwing2: Thanks for the analysis. My preferred solution would be to prune subtrees. As our trees get more detailed, it is certain that this problem will arise again. Are you able to do that? —Μετάknowledgediscuss/deeds 03:28, 14 July 2021 (UTC)[reply]
@Metaknowledge Yes, I can make the code do that. Which subtree(s) do you want pruned? Benwing2 (talk) 03:33, 14 July 2021 (UTC)[reply]
@Benwing2: Your suggestion of Bantu seems like the best course of action. (Not that efficiency is a bad idea, by the way! But it may just postpone the problem, rather than solving it.) —Μετάknowledgediscuss/deeds 03:39, 14 July 2021 (UTC)[reply]
@Benwing2: I've taken the literal no-break space solution and that has fixed the problem for now. The IDs are just to match parts of the tree with the buttons that toggle them. I played with changing the ID prefix from familytree to ft, but that only saves 16,320 out of 1,808,642 of the post-expand include size on this page. (I made changes in MediaWiki:Common.js if you still want to change the ID prefix.) Some of the classes are used in Module:family tree/style.css. familytree-branch currently isn't used, and removing it would save 174,330 out of 1,824,962 bytes in this page's template include size (partly because removing the class permits removing a HTML tag as well). I'm not enthusiastic about removing classes and HTML tags because people can use them in their personal CSS; User:Suzukaze-c probably used some of them at least in the past, but I can't remember in what stylesheet. But if you want or need to, it should not affect the great majority of users if you tear out any classes not used in Module:family tree/style.css or MediaWiki:Common.js. — Eru·tuon 04:19, 14 July 2021 (UTC)[reply]
@Erutuon Thank you. I went ahead and changed the top-level `familytree` class to `ftree`, and changed `familytree` everywhere else in classes and ID's to `ft`. I took the relevant code from MediaWiki:Common.js, hacked it to use the new names and put it in User:Benwing2/common.js. (You will have to copy the same code to User:Erutuon/common.js.) You can see the result in User:Benwing2/test-family-tree. This does not include your NBSP hack. This seems to work and reduces the template usage all the way down to 594,849 bytes, which is much smaller than I would have expected but I can't see anything wrong with the generated tree. Please take a look and let me know if something is wrong, as I would not have expected such a reduction. Benwing2 (talk) 04:29, 14 July 2021 (UTC)[reply]
@Benwing2: I'm seeing 1,622,219 bytes (reduced from 1,824,962) when I copy Module:User:Benwing2/family tree to Module:family tree and preview Category:Proto-Niger-Congo language with "Preview page with template". Still a significant reduction, but not as significant. Oh, you must be previewing User:Benwing2/test-family-tree, which doesn't have all the Module:category tree stuff. For that page, the reduction is from 663,294 to 594,849 when comparing the old to the new module (not sure why the difference between the old and new module isn't the same in this page and Category:Proto-Niger-Congo language: 68,445 bytes versus 202,743 bytes). It might be a worthwhile change anyway. The JavaScript code needs to work on both the old and new versions of the family tree (this should do it) until we can reasonably assume all pages have been updated. — Eru·tuon 17:51, 14 July 2021 (UTC)[reply]
@Erutuon: I don't remember either, and don't care about removal. —Suzukaze-c (talk) 04:46, 14 July 2021 (UTC)[reply]