Page MenuHomePhabricator

mw.wikibase.label is now appending the language code when returning the label
Closed, DuplicatePublic

Description

mw.wikibase.label is now appending the language code when returning the label.

e.g. with the below module, {{#invoke:label|label}} returns "kittenen"

see https://en.wikipedia.beta.wmflabs.org/wiki/Kitten ("it's a kittenen from Wikidata!")

compared with https://test2.wikipedia.org/wiki/Kitten

This issue might be related to https://gerrit.wikimedia.org/r/#/c/305322/ which wasn't supposed to be a breaking change.

local p = {}

function p.label( frame )
	return mw.wikibase.label( frame.args[1] )
end

function p.labelForLang( frame )
	local langcode = frame.args[1]
	local id = frame.args[2]	-- "id" must be nil, as access to other Wikidata objects is disabled in Mediawiki configuration

	return mw.wikibase.getEntityObject(id).labels[langcode].value
end

return p