Page MenuHomePhabricator

Investigation: Check parser parsing category labels
Closed, ResolvedPublic

Description

One way to show different labels for categories could be changing the labels on the backend part using the parser. E.g. by creating an extension that will use the hooks there.

  • check if hooks exist that could do that
  • check if the information from these hooks would be sufficient to also support classification if label changes should be applied
  • check extensions that might also use these hooks to interfere with labels
  • write a POC ( extension ) to change category labels

Proof of concept: https://github.com/adamwight/GenderedCategories-poc1

Event Timeline

Most interesting hook,

  • CategoryViewer::generateLink - Doesn't allow us to change the title of a category, but since we can substitute our own link instead of the results of Linker::link, it would allow HTML changes to the rendering of the category. *Update*: this is only used in category pages.

These might help us with any changes needed in the category page itself:

  • CategoryPageView - allows extensions to modify the CategoryPage instance before display.
  • CategoryViewer::doCategoryQuery - allows us to change database query results used to display the list of categories on a category page.

Another nice hook,

  • OutputPageMakeCategoryLinks - override default category link generation. Nice that it lets us do a batch calculation for the categories on a given page. Links include all HTML to render a category, so we are free to change the title.

OutputPageMakeCategoryLinks is the only remaining hook that might work for us, but still looking good. It has access to all categories, which in German includes the Frau / Herr category, satisfying our second criteria here.

The only extension to mess with OutputPageMakeCategoryLinks so far is CategoryTree, and it will only do so when $wgCategoryTreeHijackPageCategories is true, which is not configured on any Wikimedia sites.

awight updated the task description. (Show Details)
awight moved this task from Sprint Backlog to Doing on the WMDE-QWERTY-Spike-2019-07-09 board.