Page MenuHomePhabricator

Wikibase needs special handling for translatable pages
Open, Needs TriagePublic

Description

See T304978: Remove translation pages from UnconnectedPages and related API for an user report. What is the best way we can tell Wikibase about translatable pages, so that it doesn't for example list translation pages as unconnected pages?

Event Timeline

The output of Special:UnconnectedPages is determined by the unexpectedUnconnectedPage page prop, which ClientParserOutputDataUpdater::setUnexpectedUnconnectedPage() sets for any content that is neither

  • connected to an item, nor
  • a redirect, nor
  • has the expectedUnconnectedPage page prop set.

I guess we could insert a hook here, so that Translate can tell Wikibase to not consider the page “unexpected(ly) unconnected”. Or is there a relevant standard method directly on the Content or ParserOutput?

ParserOutput has methods for page props (stored in the db) and extension data. (not stored in the db) Translate already sets latter for translation pages: https://gerrit.wikimedia.org/g/mediawiki/extensions/Translate/+/d7618b5924c6476cabebe8eec2dcb544a763fd87/tag/PageTranslationHooks.php#103

What about adding a hook to SiteLinkTable::getItemIdForLink that allows Translate to fake the item ID (by providing the item ID of the translatable page)? It would make translations of connected pages work the same way as the translatable pages themselves: not appearing in Special:UnconnectedPages; showing interlanguage links; allowing access to Wikidata data without having to use mw.wikibase.getEntityIdForTitle() in Lua; etc. (Maybe the hook should run only if there is no data in the database, i.e. only allow adding virtual sitelinks to pages that have no real sitelinks, and don’t allow changing/removing real sitelinks.)