Page MenuHomePhabricator

Store whether a page is a "translation" (sub) page in the database to allow varying SQL queries
Closed, ResolvedPublic2 Estimated Story Points

Description

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

The property/tag would need to be added (automatically) going forward.

Also, a maintenance script to retrospectively (rather than waiting for translation updates to potentially propagate it) add the property/tag would be very very useful...

Event Timeline

Reedy renamed this task from Store whether a page is a "translation" (sub) page in the database to allow varying queries to Store whether a page is a "translation" (sub) page in the database to allow varying SQL queries.Sep 26 2023, 8:36 PM

@Nikerabbit Any hints where this could/should be added?

And preference whether we use MW core's page_props or Translate's revtag?

My preference would be page_props unless DBAs start screaming at me and suggesting a better solution. Just needs a small addition to PageTranslation\Hooks::renderTagPage near the end of the function. Something like

		if ( !TranslatablePage::isSourcePage( $title ) ) {
			$wikitextParser->getOutput()->setPageProperty( 'translation-page' );
		}

Cheers!

Will have a look at this again soon and make a change set in gerrit

My preference would be page_props unless DBAs start screaming at me and suggesting a better solution.

I would presume, unless we started adding the tag to every page (with a true or false), that this shouldn’t be an issue. And as such, using the existence of the row for the page being enough…

For a magnitude, Metawiki has 10k translatable pages. If we assume each translatable page has 100 translation pages (which would be awesome), we are still talking about a million extra rows. Other wikis are smaller.

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

[mediawiki/extensions/Translate@master] Add page property for translation pages

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

One condition that we may have to consider is what happens when a page marked from translation is removed from translation. Should its translations not be considered translations anymore? If so, should we remove these properties from the page?

The property will be removed automatically by next re-parse of the page. There is no need to explicitly remove page props, nor any easy way for us to retain them.

Do we re-parse translation pages automatically after unmarking?

As far as I know we call Title::invalidateCache for all translation pages. I'm not sure if that is enough, though.

Change 961970 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] Add page property for translation pages

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

Running refresh-translatable-pages.php should populate the translate-is-translation property in page_props table.

Running refresh-translatable-pages.php should populate the translate-is-translation property in page_props table.

Tracking this work in the parent task. See: https://phabricator.wikimedia.org/T299308#9333468

Marking this as done.