Jump to content

Module:Wikidata/labels

Daga Wikipedia, Insakulofidiya ta kyauta.

Documentation for this module may be created at Module:Wikidata/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
]=]

-- Fixes for 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
}

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

-- Fixes for case=infoboxdata
local infoboxdata = {
	["American Society of Health-System Pharmacists"] = "ASHP",
	["Bach Werke Verzeichnis"] = "BWV",
	["Microsoft Windows"] = "Windows",
	["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",
}

-- Support function used from Module:Wikidata/i18n for function claim with case=infoboxlabel
local function fixInfoboxLabel(label)
	local lang = mw.language.getContentLanguage()
	label = lang:lcfirst(label)
	if infoboxlabels[label] then
		label = infoboxlabels[label]
	end
	
	return lang:ucfirst(label)
end

-- Support function used from Module:Wikidata/i18n for function claim with case=infoboxdata
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,
	}