Module talk:category tree

From Wiktionary, the free dictionary
Latest comment: 3 months ago by Erutuon in topic Prenouns
Jump to navigation Jump to search

Prenouns[edit]

Hey, @Erutuon, DTLHS, could we add prenouns to Module:category tree/poscatboiler/data/lemmas? I need it for Category:Munsee prenouns, to start. --{{victar|talk}} 03:54, 12 January 2019 (UTC)Reply

Draft. I'm not familiar with the term so I just paraphrased Wikipedia. I assume they would be under "prefixes". — Eru·tuon 04:05, 12 January 2019 (UTC)Reply
labels["prenouns"] = {
	description = "Adjective-like prefixes attached to {{{langname}}} nouns.",
	fundamental = "Lemmas subcategories by language",
	parents = {"prefixes"},
}
@Erutuon: Yeah, looks fine to me, thanks. --{{victar|talk}} 04:25, 12 January 2019 (UTC)Reply
@Erutuon, for some reason I thought that page was locked out for me, which it isn't, so I just went and added it myself. Thanks. --{{victar|talk}} 04:33, 12 January 2019 (UTC)Reply
@Erutuon@Victar@ 223.180.177.149 13:59, 28 January 2024 (UTC)Reply
Why are you pinging us? — Eru·tuon 20:09, 28 January 2024 (UTC)Reply

Code for automatically linking categories to Wikipedia articles[edit]

Most category tree categories do not have a link to the corresponding Wikipedia article, though 99% could. In my fork (which integrates Wikipedia and Wiktionary) I've automatically linked such categories to Wikipedia articles by adding a wp_articles to their data. (I've also linked back by categorizing the non-language topic into the wp_categories.) Finally, I've added an editnotice to explain all topic data parameters - because that's the most heavily used one by me. Wiktionary might find some of these changes useful.

You may want to add an additional commons_articles and/or commons_categories.

You are welcome to copy/change (please attribute) all code at:

http://en.wikimergic.org/wiki/Module:Wikt/category_tree
code to handle the 2 new data values. In may case, for wp_articles, I invoke w:Template:cat main, but you could simply invoke {{wikipedia}}. So far, there was only one case where I could not find any wp_articles, so you could use the wp_categories instead. But in general, I suspect that Wiktionary won't need wp_categories as I use this for the reverse link (from my internal WP to my "dictionarizing").
http://en.wikimergic.org/wiki/Template:Editnotices/Group/Module:Wikt
Wiktionary only supports page level, so copy this for one topic data module, and redirect the others.
wp_articles
Just started adding these (into (mostly topic) data files), really only need them for the cats I'm interested in. Copy/verify my choices. Typically there is only 1, but when Wikipedia and Wiktionary do not line up, you may need several. I show the same link for each language (I only use mul: & en:), and the non-language parent topic.
wp_categories
As above. Likely not needed in Wiktionary, but ideally, one should check every Wikipedia article (or its category) and ensure it links to Wiktionary's categories. This reverse links is only made on the non-language parent topic.

Notes[edit]

  • Some topics already have hard-coded links that would need to be removed, lest there be duplicates!
    • My stuff is a work in progress. I also have hard-coded links that need to be removed...
  • Lua - I'm a decent coder in general, but just learning Lua, so rewrite to your hearts content.
  • "Wikt/" I use this prefix for all my topics and all code forked from Wiktionary so it does not interfere with code forked from Wikipedia. Strip these prefixes all off before doing a code diff! You might not notice these prefixes as I also use mw:Extension:Display Title.
  • I use a Template:change new... to highlight things in yellow. These can be removed. I also use them in category data comments.
  • Because my fork is Wikipedish, I also add
  • Currently running MediaWiki version 1.30, though I try to keep up to date on all templates and modules.
  • Ignore {{ubase-attribution}} which I use for attribution - click on the "Wiktionary" link within the red box at the top of every page.
  • My wiki is currently read-only to others. You should be able to view/copy all code by adding ?action=edit to the url.

Dpleibovitz (talk) 05:03, 6 April 2019 (UTC)Reply

What are some examples of categories that you think should link to Wikipedia? At the moment, language and language family categories like Category:English language and Category:Germanic languages do link to Wikipedia, and some categories contain a link to Wikipedia in their descriptions (not systematically or anything). — Eru·tuon 06:07, 6 April 2019 (UTC)Reply

Anything particular to outsource topics[edit]

All the existing topic cat submodules are Module:category tree/topic cat/data/<word>, so I would recommend Module:category tree/topic cat/data/Law. See Module:category tree/topic cat/data; you have to add the name of the submodule to the list.
I've added a search box and list of subpages to Module:category tree/topic cat/documentation as you suggest. — Eru·tuon 22:19, 14 December 2019 (UTC)Reply

Local alphabetizing[edit]

On category pages, there is a TOC bar at the top that indexes the entries by the first letter. It is always localized for the language (i.e. the order of the alphabet changes). How do you add a new language to this to allow there to be a TOC on category pages for that language? --Numberguy6 (talk) 20:15, 31 January 2020 (UTC)Reply

@Numberguy6: Just create a template named Template:language code-categoryTOC for the smaller version and Template:language code-categoryTOC/full for the larger version. For example, Template:en-categoryTOC and Template:en-categoryTOC/full. This module will automatically find these templates if they are needed. The smaller ToC is only used in entries with more than 200 entries in them; the larger one is used in entries with more than 2500 entries in them. So you only need to create the large ToC if the language has a large number of entries in some of its categories. — Eru·tuon 20:56, 31 January 2020 (UTC)Reply

Error[edit]

@Benwing2: It seems to me that after your edits, there was some kind of error on line 242. Gnosandes (talk) 19:00, 15 November 2020 (UTC)Reply

@Gnosandes Fixed. Benwing2 (talk) 19:01, 15 November 2020 (UTC)Reply
@Gnosandes If you still see it, do a null edit. Benwing2 (talk) 19:01, 15 November 2020 (UTC)Reply
@Benwing2: A null edit? What is it? If you mean that I should fix this error, then I do not own administrator privileges. :v Gnosandes (talk) 19:06, 15 November 2020 (UTC)Reply
@Gnosandes I don't know which page you're referring to. If you see an error on that page, edit it and save without making any changes. Benwing2 (talk) 19:10, 15 November 2020 (UTC)Reply

Sort and display additions[edit]

@Surjection: If you look at my contributions, I tested the changes on sandboxes, both with and without “sort” and “display”, and I did not see any errors when I previewed categories using the sandbox modules. J3133 (talk) 14:16, 10 August 2022 (UTC)Reply

And yet basically every category broke due to your changes, so you clearly didn't test enough. — SURJECTION / T / C / L / 14:17, 10 August 2022 (UTC)Reply
@Surjection: How else was I supposed to test? If the errors were on only specific categories I would not know. J3133 (talk) 14:19, 10 August 2022 (UTC)Reply
It was a ton of categories, because you messed up the syntax on what is now line 317 (if current:getDisplay() then instead of if current.getDisplay then; if current.getDisplay was nil, it would still try to call it, and that would cause an error). I genuinely do not understand how you did not catch that when trying to test, unless you tested nothing at all. Just trying to preview the module with the changes on a category page, like a lemma category, should have revealed the issue. — SURJECTION / T / C / L / 14:21, 10 August 2022 (UTC)Reply
@Surjection: I previewed Category:A Christmas Carol with {{topic cat/sandbox||A Christmas Carol}}, where the additions caused no errors. I do agree that I should have tested on more categories, though. Also, do you think these additions are useful? J3133 (talk) 14:21, 10 August 2022 (UTC)Reply
@Surjection: Do you know how to apply display (if it is not nil) to display_name of the steps? J3133 (talk) 15:05, 10 August 2022 (UTC)Reply
(Done. J3133 (talk) 15:30, 10 August 2022 (UTC))Reply
It's not going to work, because the next block overrides display_name unless nocap is specified. — SURJECTION / T / C / L / 16:21, 10 August 2022 (UTC)Reply