Page MenuHomePhabricator

getLabelWithLang returns wrong lang
Closed, ResolvedPublic

Description

Executing the following Lua code in hewiki

local label, lang = mw.wikibase.getLabelWithLang( 'Q532055' )

returns

label='Rosaura Revueltas'
lang='he'

(note - the label is in English, which is a fallback)

Expected:

label='Rosaura Revueltas'
lang='en'

Since getLabelWithLang doesn't provide the real language, one must manually validate it doesn't lie by:

mw.wikibase.getEntityObject( "Q532055' ).labels[lang]['language']

Related Objects

StatusSubtypeAssignedTask
InvalidNone
Resolvedaude

Event Timeline

Can anyone look into this? I can confirm that this is bug which influences client wikis.

Change 326939 had a related patch set uploaded (by Aude):
Return fallback language code for TermFallback in getLabelWithLang

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

Change 326939 had a related patch set uploaded (by Aude):
Return fallback language code for TermFallback in getLabelWithLang

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

Change 326974 had a related patch set uploaded (by Thiemo Mättig (WMDE)):
Fix language code returned by Lua's mw.wikibase.getLabelWithLang

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

thiemowmde triaged this task as Medium priority.Dec 13 2016, 3:50 PM
thiemowmde moved this task from incoming to in progress on the Wikidata board.
thiemowmde moved this task from Proposed to Review on the Wikidata-Former-Sprint-Board board.
thiemowmde added a subscriber: aude.

Change 326939 merged by jenkins-bot:
Return fallback language code for TermFallback in getLabelWithLang

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

Change 326974 merged by jenkins-bot:
Simplify unused language fallback code in Lua's mw.wikibase.getLabelWithLang

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