Page MenuHomePhabricator

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

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

daniel created this task.Jun 10 2016, 10:49 AM
Restricted Application added a project: Wikidata. · View Herald TranscriptJun 10 2016, 10:49 AM
daniel updated the task description. (Show Details)Jun 10 2016, 11:00 AM
adrianheine added a subscriber: adrianheine.EditedJun 14 2016, 8:20 AM

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

Addshore moved this task from incoming to in progress on the Wikidata board.Jun 22 2016, 1:01 PM
thiemowmde triaged this task as Normal 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.