Page MenuHomePhabricator

Investigation: Check parser parsing category labels
Closed, ResolvedPublic


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:

Event Timeline

awight added a subscriber: awight.EditedJul 15 2019, 9:36 AM

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 claimed this task.Jul 15 2019, 10:26 AM
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.
awight updated the task description. (Show Details)Jul 15 2019, 11:07 AM
awight moved this task from Doing to Review on the WMDE-QWERTY-Spike-2019-07-09 board.
Lea_WMDE closed this task as Resolved.Jul 25 2019, 1:48 PM
Lea_WMDE moved this task from Demo to Done on the WMDE-QWERTY-Spike-2019-07-09 board.