Page MenuHomePhabricator

Use interwiki code from Sites facility to create language links.
Open, MediumPublic

Description

Currently, we (ab)use the content language field from the Site object as the prefix for creating language links. This only works because the content language field does not really contain the actual content language at the moment, see T137537: Ensure correct information about Wikimedia sites in the Sites facility on the Wikimedia cluster..

We should be using the Site's "interwiki" id as the prefix instead. However, this would currently break on the Wikimedia cluster, since non-wikipedia sites have incorrect information for the "interwiki" IDs in the sites table, again see T137537: Ensure correct information about Wikimedia sites in the Sites facility on the Wikimedia cluster..

Relevant code: LangLinkHandler::getInterwikiCodeFromSite

What is now

public function getInterwikiCodeFromSite( Site $site ) {
    return $site->getLanguageCode();
}

Should become more like:

public function getInterwikiCodeFromSite( Site $site ) {
    $ids = $site->getInterwikiIds();
    return reset( $ids );
}

Event Timeline

How about we don't use interwiki prefixes here as long as they are not from the same data source that resolves them, i. e. not the same data?

Edit: I see we have to use them since that is basically the output format required by core for lang links :(

Change 294266 had a related patch set uploaded (by Adrian Heine):
Guess interwiki prefix based on global id, not language code

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

Change 294266 merged by jenkins-bot:
Guess interwiki prefix based on global id, not language code

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

thiemowmde triaged this task as Medium priority.Sep 6 2016, 10:42 AM
thiemowmde removed a project: Patch-For-Review.
thiemowmde moved this task from in progress to hold on the Wikidata board.