Page MenuHomePhabricator

Labels in languages from $wmgExtraLanguageNames cannot be used on client wikis
Closed, ResolvedPublic

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

Tarrow updated the task description. (Show Details)

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

Added the campsite for review since @guergana.tzatchkova and I aren't gonna be around on the campsite; one patch needs merging to clean up the edge case where new languages that have been added are not in cldr

Change 620996 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] Make Lua language code check more lenient

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

Added the campsite for review since @guergana.tzatchkova and I aren't gonna be around on the campsite; one patch needs merging to clean up the edge case where new languages that have been added are not in cldr

(This refers to https://gerrit.wikimedia.org/r/c/619725, but I’ve uploaded https://gerrit.wikimedia.org/r/620996 as a suggested replacement. Review from other campers appreciated!)

Change 620996 abandoned by Lucas Werkmeister (WMDE):
[mediawiki/extensions/Wikibase@master] Make Lua language code check more lenient

Reason:
in favor of I98ff5a811d

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

Change 619725 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Remove check for valid MW language code in Lua

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

Can be tested next week, I think (follow the “Lua sandbox on Swedish Wikipedia” link in the task description and paste the two code snippets into the console at the bottom).

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

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

Change 672593 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@REL1_35] Remove check for valid MW language code in Lua

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