Jump to content

Module:Wikidata/proves/labels

Ón Vicipéid, an chiclipéid shaor.

Documentation for this module may be created at Module:Wikidata/proves/labels/doc

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

-- Fixes for function getLabel
local infoboxLabelsFromId = {
}

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

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

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

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

-- Excepcions per a function getLabel

local infoboxLabelsFromId = {
	["P1350"] = "Cluichí",
	["Q50000"] = "Bua",
}

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

local infoboxlabels = {
}

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

local infoboxdata = {
}

-- Codi de funcions de suport

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

local function fixInfoboxData(label)
	return label
end

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