⚓ T299308 Add Hide translations to Special:PrefixIndex
Page MenuHomePhabricator

Add Hide translations to Special:PrefixIndex
Closed, ResolvedPublic8 Estimated Story PointsFeature

Description

Feature summary:
Add a checkbox that allows hiding translation pages to Special:PrefixIndex.

Use case(s) and benefits
For example, see mw:Special:PrefixIndex/Extension:AbuseFilter/. The special page listed 117 subpages, in which only 27 should be counted as independent pages. The rest (i.e. 90 translation pages) made it extremely difficult for me to filter out contents that I don't need. There should be an option for users like me to directly hide them using a checkbox similar to Hide redirects and Strip prefix.

Current status

We've added a property in the page_prop the to distinguish translation pages, and filter them out.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

@Bugreporter Hmm, how is this related to the Translate extension codebase?

At least "translation pages" are something from the Translate extension and such a feature does not only belong to core.

Nikerabbit moved this task from Backlog to cross projects on the MediaWiki-extensions-Translate board.
Nikerabbit subscribed.

There doesn't seem to be a hook in core to do this. Without a hook this cannot be implemented in Translate.

This could be implemented in MediaWiki core directly (compare with Special:MyLanguage) as well.

I have the same issue at https://www.mediawiki.org/wiki/Continuous_integration#Documents which has:

{{Special:PrefixIndex/Continuous_integration/|stripprefix=1|hideredirects=1}}

The code is includes/specials/SpecialPrefixIndex.php which is crafting a SQL query to retrieve the page. Based on @Nikerabbit comment, we would need a hook to have extension to contribute to the SQL query conditions and possibly the ability to add a join. I have no idea how they can be identified / filtered out though

Change 961226 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/core@master] SpecialPrefixIndex: Allow extensible filters

https://gerrit.wikimedia.org/r/961226

Change 961235 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/Translate@master] WIP: Add translation page filter to PrefixIndex

https://gerrit.wikimedia.org/r/961235

I've started this, and then got to a bit of a blocker...

If it need to be done with SQL, perhaps setting a prop in page_props (or revtag) could make it fast and accurate enough?

I suspect we can probably get the MW core patch in a state that can land, the Translate patch is going to be blocked on something like the above happening...

Unless we do the processing post query, using the functions mentioned in T216368#5832155, but feels slow and will reduce the amount of results...

abi_ subscribed.

Current implementation adds a new filter to Special:PrefixIndex to remove translations

Without filter appliedWith hide translation filter applied
image.png (585×1 px, 31 KB)
image.png (560×1 px, 29 KB)

For this feature to work, the translation pages should have the translate-is-translation property set in the page_props table. To back fill this property for existing pages, we should run the refresh-translatable-page.php script. Script to run:

cd /srv/mediawiki/php-1.xx-wmf.xx/
mwscript extensions/Translate/scripts/refresh-translatable-pages.php --wiki {wikiname} --jobqueue

List of wikis where the Translate extension is enabled are:

  • advisorswiki - 21-11-2023 - 0 translation pages
  • amwikimedia - 21-11-2023 - 0 translation pages
  • azwikimedia - 21-11-2023 - 0 translation pages
  • bewikimedia - 21-11-2023 - 0 translation pages
  • betawikiversity - 21-11-2023 - 635 translation pages
  • brwikimedia - 21-11-2023 - 50 translation pages
  • bdwikimedia - 21-11-2023 - 80 translation pages
  • cawikimedia - 21-11-2023 - 115 translation pages
  • collabwiki - 29-11-2023 - 853 translation pages
  • commonswiki - 05-12-2023 - 23930 translation pages
  • testcommonswiki - Inactive
  • foundationwiki - 30-11-2023 - 3467 translation pages
  • frwiktionary - 27-11-2023 - 178 translation pages
  • gewikimedia - 23-11-2023 - 42 translation pages
  • grwikimedia - 23-11-2023 - 0 translation pages
  • hiwikimedia - 23-11-2023 - 0 translation pages
  • idwikimedia - 23-11-2023 - 23 translation pages
  • incubatorwiki - 29-11-2023 - 1869 translation pages
  • legalteamwiki - 29-11-2023 - 33 translation pages
  • maiwikimedia - 23-11-2023 - 4 translation pages
  • mediawikiwiki - 06-12-2023 - 82809 translation pages
  • metawiki - 25-01-2024 - 163234 translation pages
  • nowikimedia - 23-11-2023 - 167 translation pages
  • otrs_wikiwiki - 29-11-2023 - 469 translation pages
  • outreachwiki - 29-11-2023 - 2477 translation pages
  • plwikimedia - 23-11-2023 - 6 translation pages
  • ptwikisource - 27-11-2023 - 15 translation pages
  • punjabiwikimedia - 23-11-2023 - 0 translation pages
  • ruwikimedia - 23-11-2023 - 345 translation pages
  • sourceswiki - 30-11-2023 - 202 translation pages
  • specieswiki - 29-11-2023 - 2411 translation pages
  • sewikimedia - 23-11-2023 - 197 translation pages
  • testwiki - 16-11-2023 - 220 translation pages
  • testwikidatawiki - 16-11-2023 - 141 translation pages
  • uawikimedia - 27-11-2023 - 44 translation pages
  • vewikimedia - 27-11-2023 - 2 translation pages
  • wbwikimedia - 27-11-2023 - 0 translation pages
  • wikidatawiki - 05-12-2023 - 19230 translation pages
  • wikifunctionswiki - 20-11-2023 - 758 translation pages
  • wikimania2012wiki - 20-11-2023 - 456 translation pages
  • wikimania2013wiki - 20-11-2023 - 212 translation pages
  • wikimania2014wiki - 20-11-2023 - 279 translation pages
  • wikimania2015wiki - 20-11-2023 - 985 translation pages
  • wikimania2016wiki - 20-11-2023 - 791 translation pages
  • wikimania2017wiki - 20-11-2023 - 1273 translation pages
  • wikimania2018wiki - 20-11-2023 - 317 translation pages
  • wikimaniawiki - 20-11-2023 - 3675 translation pages

We will start with test wikis, and then smaller wikis until the script is run on all the wikis.

Nikerabbit changed the task status from Open to In Progress.Nov 23 2023, 8:48 AM

The updated refresh-translatable-page.php script was fixed, and we've run the script across all wikis where the Translate extension is enabled.

Change 961226 merged by jenkins-bot:

[mediawiki/core@master] SpecialPrefixIndex: Allow extensible filters

https://gerrit.wikimedia.org/r/961226

Change 961235 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] Add translation page filter to PrefixIndex

https://gerrit.wikimedia.org/r/961235

Deployed on translatewiki.net

Special:PrefixIndex without "Hide translation pages"Special:PrefixIndex with "Hide translation pages"
image.png (798×1 px, 59 KB)
image.png (551×852 px, 35 KB)

I have edited translate-hidetranslations=1 to an existing transclusion https://www.mediawiki.org/w/index.php?title=Continuous_integration&diff=prev&oldid=6378855 and that worked like a charm (there are translations for Quibble still showing up, but that is a different issue).

Thank you so much!