Page MenuHomePhabricator

Interlanguage links not appearing on Flow pages
Closed, DuplicatePublic

Description

The interlanguage links (links on the left sidebar to pages on the same topic in other languages) are not appearing on pages where the content model is Flow, even when the corresponding Wikidata item has linked pages on other wikis.

Examples:
https://gom.wikipedia.org/wiki/विकिपीडिया:Tinto
https://ca.wikipedia.org/wiki/Viquipèdia:La_taverna/Tecnicismes
https://pl.wikipedia.org/wiki/Pomoc:Pytania_nowicjuszy
https://zh.wikipedia.org/wiki/Wikipedia:%E7%9F%A5%E8%AF%86%E9%97%AE%E7%AD%94
https://www.mediawiki.org/wiki/Project:Support_desk

Event Timeline

Catrope subscribed.

I'm guessing this is probably a bug in how Wikidata injects these language links? If it turns out to be a bug in Flow, or if Flow turns out to do something unhelpful, please do let us know.

I looked into this a bit:

The langlinks table is empty:

mysql:wikiadmin@db1078 [gomwiki]> SELECT * FROM langlinks WHERE ll_from = 7451;
Empty set (0.00 sec)

The language links of the ParserOutput are also empty:

hoo@terbium:~$ mwscript eval.php --wiki gomwiki 
> $wikiPage = new WikiPage( Title::newFromID(7451) );

> $popts = ContentHandler::getForTitle( Title::newFromID(7451) )->makeParserOptions( 'canonical' );    

> var_dump( $wikiPage->getParserOutput( $popts ) );
…
  ["mLanguageLinks"]=>
  array(0) {
  }
…

Wikibase is enabled for the NS in question:

hoo@terbium:~$ mwscript eval.php --wiki gomwiki
> var_dump( Wikibase\Client\WikibaseClient::getDefaultInstance()->getNamespaceChecker()->isWikibaseEnabled( Title::newFromID(7451)->getNamespace() ) );
bool(true)

useRepoLinks is true:

hoo@terbium:~$ mwscript eval.php --wiki gomwiki
> $popts = ContentHandler::getForTitle( Title::newFromID(7451) )->makeParserOptions( 'canonical' );

> $wikiPage = new WikiPage( Title::newFromID(7451) );

> $out = $wikiPage->getParserOutput( $popts );

> var_dump( Wikibase\Client\WikibaseClient::getDefaultInstance()->getLangLinkHandler()->useRepoLinks( Title::newFromID(7451), $out ) );
bool(true)

The problem is that Wikibase uses the ContentAlterParserOutput hook to inject the language links, but Flow doesn't call that. Will fix.

Change 379294 had a related patch set uploaded (by Hoo man; owner: Hoo man):
[mediawiki/extensions/Flow@master] Make BoardContent::getParserOutput call the "ContentAlterParserOutput" hook

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

Change 379294 merged by jenkins-bot:
[mediawiki/extensions/Flow@master] Make BoardContent::getParserOutput call the "ContentAlterParserOutput" hook

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

Update, after my Flow patch got merged:

The langlinks table is still empty:

mysql:wikiadmin@db1078 [gomwiki]> SELECT * FROM langlinks WHERE ll_from = 7451;
Empty set (0.00 sec)

But the language links in the ParserOutput aren't:

hoo@terbium:~$ mwscript eval.php --wiki gomwiki 
> $wikiPage = new WikiPage( Title::newFromID(7451) );

> $popts = ContentHandler::getForTitle( Title::newFromID(7451) )->makeParserOptions( 'canonical' );    

> var_dump( $wikiPage->getParserOutput( $popts ) );
…
  ["mLanguageLinks"]=>
  array(224) {
    [0]=>
    string(36) "ab:Авикипедиа:Афорум"
    [1]=>
    string(22) "ace:Wikipedia:Meusapat"
    [2]=>
…
  }
…

After that I purged with forcelinksupdate and even removed the link on Wikidata and re-added it, but this still didn't help, the langlinks still don't make it into the DB.