Hopp til innhold

Modul:Wikidades/labels

Fra Wikipedia, den frie encyklopedi
Sideversjon per 28. jan. 2025 kl. 19:57 av Tholme (diskusjon | bidrag)
(diff) ← Eldre sideversjon | Nåværende sideversjon (diff) | Nyere sideversjon → (diff)
Moduldokumentasjon


--[=[
	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 = {
	["Q130146"]   = "EMEA",              -- en:European Medicines Agency             infobox: fàrmac
	["Q204711"]   = "FDA",               -- en:Food and Drug Administration          infobox: fàrmac
	["Q4745081"]  = "AHFS",    -- en:American Society of Health-System Pharmacists   infobox: fàrmac
	["Q186081"]   = "Dato",    -- tidsintervall -> dato
}

-- 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 = {
	["American Society of Health-System Pharmacists"] = "ASHP",
	["Bach Werke Verzeichnis"] = "BWV",
	["tonatge de pes mort"] = "DWT",
	["Codi Internacional de Nomenclatura Zoològica"] = "CINZ",
	["Codi Internacional de Nomenclatura Botànica"] = "CINB",
	["Codi Internacional de Classificació i Nomenclatura de Virus"] = "CICNV",
	["Codi Internacional de Nomenclatura per a Plantes Cultivades"] = "CINPC",
	["Codi Internacional de Nomenclatura de Bacteris"] = "CINBa",
	["Berkeley Open Infrastructure for Network Computing"] = "BOINC",
	["Advanced Packaging Tool"] = "APT",
	["GNU General Public License"] = "GNU GPL",
	["Common Development and Distribution License"] = "CDDL",
	["Kaiserliche und Königliche Kriegsmarine"] = "K.u.K. Marine",
}

-- Codi de funcions de suport

local function fixInfoboxLabel(label, type)
	local lang = mw.language.getContentLanguage()
	label = lang:lcfirst(label)
	if infoboxlabels[label] then
		label = infoboxlabels[label]
	else
		label = string.gsub(label, " %(.+", "")
	end
	
	return lang:ucfirst(label)
end
	

local function fixInfoboxData(label)
	if infoboxdata[label] then
		label = infoboxdata[label]
	end
	
	return label
end

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