Page MenuHomePhabricator

Labels in languages from $wmgExtraLanguageNames cannot be used on client wikis
Open, Needs TriagePublic

Description

As a Wikipedia editor, I want to get all labels of a Wikidata item, in order to be able to describe an item not just in the content language of my wiki, but also in several other minority languages it covers.

Problem:
Wikidata includes support for several custom language codes, by setting $wmgExtraLanguageNames in InitialiseSettings.php (warning, large file, may slow down your browser). However, those language codes are only defined for Wikidata (test and real) and Commons; on client wikis, Wikibase does not consider them to be valid, and therefore refuses to return labels in those languages, even if they’re defined on Wikidata. See discussion on Project_chat#Kven

Example:
Swedish Wikipedia would like to use the smj label of Tysfjord (Q493851), or the fkv label of Porsanger (Q483885). The following work snippets work in a Lua sandbox on Wikidata, but not in a Lua sandbox on Swedish Wikipedia:

=mw.wikibase.getLabelByLang( 'Q493851', 'smj' )
=mw.wikibase.getLabelByLang( 'Q483885', 'fkv' )

Screenshots/mockups:

BDD
GIVEN
AND
WHEN
AND
THEN
AND

Acceptance criteria:

  • Labels in languages from $wmgExtraLanguageNames can be used on client wikis

Open questions:

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFri, Jul 31, 11:06 AM
Maintenance_bot moved this task from incoming to in progress on the Wikidata board.Tue, Aug 4, 1:15 PM
Michael updated the task description. (Show Details)Tue, Aug 4, 1:17 PM
Tarrow added a subscriber: Tarrow.Mon, Aug 10, 12:06 PM

I'm pairing on this too!

Tarrow updated the task description. (Show Details)Mon, Aug 10, 1:04 PM
Tarrow updated the task description. (Show Details)
Tarrow added a comment.EditedMon, Aug 10, 1:14 PM

We've decided that given the scope of this request we anticipate that the only concern is being able to use the labels in Lua. @Lydia_Pintscher does that sound ok?

A quick investigation of the property parser function seems to suggest that this particular case wouldn't be possible anyway (since it appears that only user languages can be what is rendered).

Change 619453 had a related patch set uploaded (by Tarrow; owner: Tarrow):
[mediawiki/extensions/Wikibase@master] Use Wikibase Term languages for SpecialItemDisambiguation

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

Change 619456 had a related patch set uploaded (by Tarrow; owner: Tarrow):
[mediawiki/extensions/Wikibase@master] Add Wikidata's $wgExtraLanguageNames to Terms WikibaseContentLanguages

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

We've discovered that *part* of the problem here is an early escape in the lua that was added in I75d3c70302270a62db93b7e1fe790b2355f75dc2 with the intention of preventing bad keys getting into the cache.

So we also need to adapt this carefully in such a way that we don't make the cache breakable again

Change 619725 had a related patch set uploaded (by Tarrow; owner: Tarrow):
[mediawiki/extensions/Wikibase@master] Remove check for valid MW language code in Lua

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

Change 619453 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Use Wikibase Term languages for SpecialItemDisambiguation

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

Change 619456 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Add Wikidata's $wgExtraLanguageNames to Terms WikibaseContentLanguages

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