WMDE Technical Wishes/Gendered Categories

From Meta, a Wikimedia project coordination wiki

About this project[edit]

In some cases, it's necessary to render category labels differently depending on the subject of an article. For example, in German Wikipedia any article about an Ärztin (woman doctor) displays category "Arzt" rather than the correctly gendered category. In English Wikipedia, a British "theatre director" and American "theater director" could be categorized under the spelling variant the subjects would use for themselves, only this one title should appear on the article, but both country's directors should appear on a single category's list.

A 2017 survey of German-speaking Wikipedians identified this as a priority to fix. What this project isn't about: Please note that this project is not about changing the systematics of the category system. For example, categories are not to be renamed or split. Nor is it a question of whether the generic masculine should be used in personal articles or in list articles. Also, the problem concerns the desktop view, because categories are hidden in the mobile view.

Status[edit]

  • The Technical Wishes team has conducted deeper technical investigations to solve this problem.
  • Two solutions were presented on German Wikipedia in August/September 2019:
    • A: MediaWiki extension GenderCat by user:Slomox (project page, in German)
    • B: Fixing category redirects (see below) Both solutions had between 40 and 50 supporters each, but it became clear that a number of people wanted to first reach a community consensus before the feature got implemented.
  • Development is on hold until community consensus is reached.
  • July 2021: The wish is removed from the list of planned projects, because there is no community consensus yet and the focus of the Technical Wishes will be set on the work in focus areas in the future. However, it would be conceivable that in one of the upcoming surveys on German Wikipedia a suitable focus area (e.g. "improve category system" or "technical measures to promote diversity") is put to the vote in which this wish is included. However, a community consensus would then have to be conducted prior to the survey so that, if the poll is successful, time can be ideally used for implementation.

Technical investigation[edit]

There are currently two types of category redirect, which are summarized below. Neither one is appropriate for our use cases.

Soft redirect categories[edit]

Categories are only ever soft-redirected to one another.[1] In English Wikipedia, this is accomplished with the {{Category redirect}} template, which is helpful for common typos such as "Category:Stub" when "Category:Stubs" was intended. A soft-redirected category should never be used from an article, but when this does happen a bot will rewrite the article's category links to directly use the target category instead. Soft-redirect category pages themselves remain indefinitely, or until they are no longer needed.

Note that these category redirects are inappropriate for the use cases we're trying to solve: labeling an article with a soft-redirected category will simply result in the article being rewritten to use the main category instead. We need a different mechanism to permanently alias a category.

Hard redirects are broken[edit]

At first glance there should be two ways to redirect a category, like any other wiki page: either with a soft redirect template or by the hard-redirect "#REDIRECT[[...]]" directive in wikitext. Unfortunately, a hard redirect is never correct for a category and a bot will rewrite the hard redirect as a soft redirect. This is "because of the software's inability to recategorize pages from redirected categories."[1] An article page using the redirect category will be a member of the alias but not the target category. At the same time, visiting the alias category page results in a browser redirect to the target category (unless the magical redirect=no was included), which does not include the article we came from. This is a confusing user experience, so it's avoided.

Existing bots will rewrite any hard redirected categories as a templated soft redirect, using the "Category redirect" template such as in this edit.

Proposal: category aliasing[edit]

A flexible solution to this problem is to allow one category to "alias" to another, so that the alias shows up on article pages, but regardless of alias all members of a category appear on the main category page. There are two implementations currently under investigation, outlined below.

Implementation A: New hard redirect behavior[edit]

Tracked in Phabricator:
Task T227877

We can change the behavior of hard-redirected category pages, so that the linking article is categorized under the redirect target category. If an article is categorized with [[Category:Theater director]] (Am. English), and the "Category:Theater director" page contains the source "#REDIRECT[[:Category:Theatre directors]]" (Br. English), then an American director's biographical article will display the "Theater director" category, but will show up on the main category page, "Category:Theatre directors".

A similar idea for category redirects has been around since at least 2005,[2] and deployed in 2009 but the implementation was incomplete and quickly reverted. Onwiki discussion[3][4][5][6] was generally positive though without reaching consensus, and focused on fixing the edge cases. The revert was made for technical reasons, the feature had not been completely specified and the code was no more than several lines' proof of concept. Another, more complete implementation was attempted in 2013 but never deployed.[7][8]

Hard redirects are a tempting way to implement this feature, because current behavior is broken, but it's still debatable whether the new proposed behavior is consistent with editors' expectations.

Implementation B: Non-page representations for aliases[edit]

Category aliases could be stored in a custom table, Wikidata, or another backend. We don't necessarily have to create a category page for each alias.

On an article page, the alias could be chosen by passing parameters to the category link, for example "[[Category:Theatre directors|Theater director]]". There are alternatives for the syntax, the important part is that we avoid maintaining the aliases as categories. Alias lookup will be through external storage, perhaps P2521.

Technical debt is a risk. The many places where MediaWiki code interacts with categories all need to be patched or overridden by hooks, e.g. making the aliases available in search and autocomplete features.

Feedback[edit]

Feedback is always welcome. Please use the talk page in case you have any comments, advice or questions.

References[edit]