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

StatusAssignedTask
OpenNone
Resolvedaude
eranroz created this task.Dec 2 2016, 8:56 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 2 2016, 8:56 PM

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

Marius, Thiemo: Can you have a look?

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

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

aude claimed this task.Dec 13 2016, 2:06 PM

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 Normal priority.Dec 13 2016, 3:50 PM
thiemowmde added a project: Wikidata-Sprint.
thiemowmde moved this task from incoming to in current sprint on the Wikidata board.
thiemowmde moved this task from Proposed to Review on the Wikidata-Sprint 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

Jonas moved this task from Review to Done on the Wikidata-Sprint board.Dec 19 2016, 11:34 AM

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

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

hoo closed this task as Resolved.Dec 20 2016, 9:20 AM