Mukääcëtök:Wikidata/labels

Jɔk Wikipedia

Documentation for this module may be created at Mukääcëtök:Wikidata/labels/doc

--[=[
	Tables with labels fixed for infoboxes. Keep the structure:

-- Fixes for function getLabel
local infoboxLabelsFromId = {
}

-- Support function used from Module:Wikidata/i18n for function claim with case=infoboxlabel
local function fixInfoboxLabel(label)
	return label
end

-- Fixes for case=infoboxlabel
local infoboxlabels = {
}

-- Fixes for case=infoboxdata
local infoboxdata = {
}

]=]


-- Correccions d'etiquetes de forma adequada per a una infotaula (paràmetre label)
-- S'usa a function claim amb case=infoboxlabel

local infoboxlabels = {
	["capital"] = "city",
}

-- Canvis en valors necessaris per a una infotaula (paràmetre data)

local infoboxdata = {
	["Bach Werke Verzeichnis"] = "BWV",
}

local function fixInfoboxLabel(label)
	local lang = mw.language.getContentLanguage()
	label = lang:lcfirst(label)
	if infoboxlabels[label] then
		label = infoboxlabels[label]
	else
		label = string.gsub(label, " de .+", "")
		label = string.gsub(label, " dels? .+", "")
		label = string.gsub(label, " d'.+", "")
		label = string.gsub(label, " %(.+", "")
		if label == 'estat' then
			label = 'estat federat'
		end
	end
	
	return lang:ucfirst(label)
end


-- Return exported functions
return {
	infoboxLabelsFromId = infoboxLabelsFromId,
	fixInfoboxLabel = fixInfoboxLabel,
	infoboxdata = infoboxdata
	}