Mòdul:Wikidadas/labels

Un article de Wikipèdia, l'enciclopèdia liura.

La documentacion d'utilizacion d'aquel modul se pòt crear a Mòdul:Wikidadas/labels/ús

--[=[
	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 las foncions getLabel

local infoboxLabelsFromId = {
	["P40"]   = "Filhs",                -- text adjusted for infobox                 infobox: identitat
	["P57"]   = "Direccion",             -- text adjusted for infobox                infobox: organitzacion,.. 
	["P69"]   = "Formacion",             -- text adjusted for infobox                infobox: identitat 
	["P97"]   = "Títol",                -- text adjusted for infobox                 infobox: identitat
	["P102"]  = "Partit",               -- text adjusted for infobox                 infobox: politician
	["P136"]  = "Genre",               -- text adjusted for infobox                  infobox: organitzacion
	["P138"]  = "Eponim",               -- text adjusted for infobox                 infobox: all
	["P150"]  = "Conten la subdivision",  -- text adjusted for infobox               infobox: geografia politica
	["P159"]  = "Sèdi",                  -- text adjusted for infobox                 infobox: luòc web
	["P161"]  = "Articles sommitats",     -- text adjusted for infobox               infobox: identitat
	["P166"]  = "Premis",               -- text adjusted for infobox                 infobox: all
	["P181"]  = "Distribucion",
	["P186"]  = "Material",             -- text adjusted for infobox                 infobox: tèst
	["P412"]  = "Votz",                  -- text adjusted for infobox                 infobox: identitat
	["P417"]  = "Pairinatge",            -- text adjusted for infobox                infobox: geografia politica
	["P428"]  = "Abrev. botanica",      -- text adjusted for infobox                 infobox: identitat
	["P421"]  = "Fus orari",           -- text adjusted for infobox                  infobox: geografia politica
	["P571"]  = "Creacion",              -- text adjusted for infobox                infobox: organitzacion
	["P697"]  = "Exautor",              -- text adjusted for infobox                 infobox: tèst
	["P737"]  = "Influéncias",          -- text adjusted for infobox                 infobox: identitat
	["P742"]  = "Altres noms",          -- text adjusted for infobox                 infobox: all
	["P800"]  = "Obres destacables",    -- text adjusted for infobox                 infobox: identitat
	["P802"]  = "Alumnes",              -- text adjusted for infobox                 infobox: identitat
	["P835"]  = "Abrev. zoologia",      -- text adjusted for infobox                 infobox: identitat
	["P856"] = "Site web",              -- text adjusted for infobox                 infobox: tèst
	["P915"] = "Rodatge",               -- text adjusted for infobox                 infobox: tèst
	["P921"] = "Tema",                  -- text adjusted for infobox                 infobox: tèst
	["P1038"] = "Parents",              -- text adjusted for infobox                 infobox: persona
	["P1066"] = "Professors",           -- text adjusted for infobox                 infobox: persona
	["P1120"] = "Morts",                -- text adjusted for infobox                 infobox: tèst
	["P1135"] = "Estatus",              -- text adjusted for infobox                 infobox: tèst
	["P1174"] = "Visitaires anuals",     -- text adjusted for infobox                infobox: organitzacion
	["P1191"] = "Estrena",              -- text adjusted for infobox                 infobox: tèst
	["P1339"] = "Ferits",               -- text adjusted for infobox                 infobox: tèst
	["P1411"] = "Nominacions",          -- text adjusted for infobox                 infobox: tèst
	["P1412"] = "Lenga",              -- text adjusted for infobox                   infobox: all
	["P1420"] = "Sinonims",             -- text adjusted for infobox                 infobox: tèst
	["P1446"] = "Desapareguts",         -- text adjusted for infobox                 infobox: tèst
	["P1538"] = "Lars",                -- text adjusted for infobox                  infobox: geografia politica
	["P1559"] = "Nom original",         -- text adjusted for infobox                 infobox: all
	["P1619"] = "Obertura",             -- text adjusted for infobox                 infobox: tèst
	["P1672"] = "Font de",              -- text adjusted for infobox                 infobox: tèst
	["P2044"] = "Altitud",              -- text adjusted for infobox                 infobox: geografia politica
	["P2048"] = "Auçada",               -- text adjusted for infobox                 infobox: identutat
	["P2067"] = "Massa",                  -- text adjusted for infobox               infobox: identitat
	["P2541"] = "Ambit",                -- text adjusted for infobox                 infobox: tèst
	["P2257"] = "Frequéncias",           -- text adjusted for infobox                infobox: tèst
	["P2635"] = "Parts",                -- text adjusted for infobox                 infobox: tèst	
	["P2659"] = "Isolament",            -- text adjusted for infobox                 infobox: tèst	
	["P2852"] = "Numèro d'emergéncias", -- text adjusted for infobox                 infobox: geogr.política
	["P2868"] = "Ten lo ròtle",              -- text adjusted for infobox            infobox: persona
	["P3373"] = "Fraires",              -- text adjusted for infobox                 infobox: identitat
	["P3712"] = "Objectius",            -- text adjusted for infobox                 infobox: test
	["P3999"] = "Clausura",             -- text adjusted for infobox                 infobox: tèst
	["P4647"] = "Escenari",             -- text adjusted for infobox                 infobox: tèst
	["P4628"] = "Genòma",

	["Q7566"]     = "Parents",             -- en:parents                              infobox: identitat
    ["Q929848"]   = "Movements",         -- en:movements                              infobox: tèst
	["Q1921834"]  = "Caracteristicas",  -- en:characteristics                         infobox: all
	["Q130146"]   = "EMEA",              -- en:European Medicines Agency              infobox: medicament
	["Q204711"]   = "FDA",               -- en:Food and Drug Administration           infobox: medicament
	["Q215972"]   = "Protagonistes",     -- en:protagonist                            infobox: tèst
    ["Q959782"]   = "Excavacions",       -- en:(archeological) excavations            infobox: tèst
    ["Q1207505"]  = "Donadas e chifras",    -- en:quality                               infobox: pel·lícula
	["Q4745081"]  = "AHFS",    -- en:American Society of Health-System Pharmacists    infobox: medicament
	["Q7406919"]  = "Servicis",           -- en:services                              infobox: all
    ["Q29933828"] = "Lançament",        -- text adjusted for infobox                  infobox: site web
	["Q55579539"] = "Activitat",         -- en:work period                            infobox: organitzacion
    ["Q60313278"] = "Categoria:Articles de geografia politica sense foto",  --        infobox: IGP
                            -- en:Category:Wikipedia requested photographs by administrative location

	["T0001"] = "ANULLAT",             -- en:VOID                                     infobox: all
	["T0002"] = "ANULLAT",             -- en:VOID                                     infobox: all
	["T0003"] = "ANULLAT",             -- en:new position (no value in P39/P1365)     infobox: all
	["T0004"] = "ANULLAT",             -- en:ended position (no value in P39/P1366)   infobox: all
	["T0005"] = "ANULLAT",             -- en:unknown date (as a property value)       infobox: all
	["T0006"] = "ANULLAT",             -- en:VOID                                     infobox: all
	["T0007"] = "ANULLAT",             -- en:discovery of body                        infobox: tèst
	["T0008"] = "Conegut per",         -- en:known by                                 infobox: tèst
	["T0009"] = "ANULLAT",             -- en:remarkable ideas (philosophers, etc.)    infobox: tèst
	["T0010"] = "ANULLAT",             -- en:Period in service (military)             infobox: tèst
	["T0011"] = "ANULLAT",             -- en:end of worship (religion)                infobox: tèst
	["T0012"] = "ANULLAT",             -- en:disciples, followers (phil. relig, ..)   infobox: tèst
	["T0013"] = "ANULLAT",             -- en:present team (sports)                    infobox: tèst
	["T0014"] = "ANULLAT",             -- en:professional withdrawn (sports)          infobox: tèst
	["T0015"] = "Estudiants notables",
	["T0016"] = "Autres estudiants notables",
	["T0017"] = "Conselh academic",
	["T0018"] = "Situacion judiciària",
	["T0019"] = "Enaltiment",
	["T0020"] = "Istòria e celebracions",
	["T0021"] = "Cota iniciala",         -- en:starting spot height (river, walk)     infobox: tèst
	["T0022"] = "Cota finala",           -- en:ending spot height (river, walk)       infobox: tèst
	["T0023"] = "Mars contigus",        -- en:adjacent seas (each side of a strait)   infobox: tèst
	["T0024"] = "Ciutats riberenquas",  -- en:riverside cities (of body of water)     infobox: tèst
	["T0025"] = "Element vertebrador",  -- en:linking element (item and its environment) infobox: tèst
	["T0026"] = "Cimas destacadas",       -- en:highlighted summits                   infobox: tèst
	["T0027"] = "ANULLAT",             -- en:starting spot height (river, walk)       infobox: tèst
	["T0028"] = "ANULLAT",             -- en:ending spot height (river, walk)         infobox: tèst
	["T0029"] = "Ciutat mai prospera",   -- en:nearest city                           infobox: tèst
	["T0030"] = "Mesures e indicadors", -- en:measures and indicators (section)       infobox: tèst
	["T0031"] = "Mijana de precipitacions", -- en:rainfall average                    infobox: tèst
	["T0032"] = "Congelacion",           -- en:freezing                               infobox: tèst
	["T0033"] = "Tipe cascada",        -- en:Typus of waterfall (shape)               infobox: tèst
	["T0034"] = "Auçada cascada",       -- en:Waterfall height (full falls)           infobox: tèst
	["T0035"] = "Salt mai long",       -- en:highlighted summits                      infobox: tèst
	["T0036"] = "Dificultat",           -- en:difficulty (for tracks, climb,..)       infobox: tèst
	["T0037"] = "Cultura/pobladors",    -- en:cultural/ethnic roots                   infobox: tèst
	["T0038"] = "Tipes d'erupcion",      -- en:kind of eruption (volcanic)            infobox: tèst
	["T0039"] = "Darrièra erupcion",       -- en:last eruption (volcanic)               infobox: tèst
	["T0040"] = "Pistas",               -- en:pistes (ski piste plural)               infobox: tèst
	["T0041"] = "Rut normal",          -- en:main itinerary (GR, trail, pathfoot)     infobox: tèst
	["T0042"] = "Etapas",               -- en:stages (GR, trail, pathfoot)            infobox: tèst
	["T0043"] = "Religar d'autres caminòls", -- en:link to other trails (GR, pathfoot)     infobox: tèst
	["T0044"] = "Separacion mínima",     -- en:minimum separation (straits),               infobox: tèst
	["T0045"] = "Fusion de", -- en:amalgamation (entity "E" originated by merging "A"+"B") infobox: organitzacion
	["T0046"] = "ANULLAT",             -- en:Merge with (entity "E" merge with "A"+...)    infobox: organitzacion
	["T0047"] = "ANULLAT",             -- en:reconstruction  (entity second creation)      infobox: organitzacion
	["T0048"] = "Redissolucion",         -- en:redissolved (to dissolve entity again)      infobox: organitzacion
	["T0049"] = "Ambit",                -- en:thematic scope (library/museum area)         infobox: organitzacion
	["T0050"] = "ANULLAT",             -- en:collections (museum specific collections)     infobox: organitzacion 
	["T0051"] = "Tipe de documents",   -- en:type of documents (in archive or museum)      infobox: organitzacion
	["T0052"] = "ANULLAT",             -- en:book loans by year (in library )              infobox: organitzacion
	["T0053"] = "ANULLAT",             -- en:potential population (library, hospital,..)   infobox: organitzacion
	["T0054"] = "ANULLAT",             -- en:member (of the club/organitzation/society)    infobox: organitzacion
	["T0055"] = "Membres predecessors",    -- en:past members (music group/club/art school) infobox: organitzacion
	["T0056"] = "ANULLAT",             -- en:featured instruments (music group)            infobox: organitzacion
	["T0057"] = "ANULLAT",             -- en:keyperson (within the organitzation)          infobox: organitzacion
	["T0058"] = "Membres destacats",    -- en:remarkable members                           infobox: organitzacion
	["T0059"] = "ANULLAT",             -- en:cap de colla (chief of castells team)         infobox: organitzacion
	["T0060"] = "ANULLAT",         -- en:Youth Party (political party youth branch)        infobox: organitzacion
	["T0061"] = "ANULLAT",         -- en:allied organization                               infobox: organitzacion
	["T0062"] = "ANULLAT",         -- en:rival organization                                infobox: organitzacion
	["T0063"] = "ANULLAT",         -- en:remarkable figures (organitzation's indicators)   infobox: organitzacion
	["T0064"] = "ANULLAT",         -- en:Other information                                 infobox: organitzacion, ICQ, Llibre
	["T0065"] = "ANULLAT",         -- en:company estate (not the HQ, but the origin)       infobox: organitzacion
	["T0066"] = "ANULLAT"          -- en:type of organisation & management                 infobox: organitzacion
}

-- Correccions d'etiquetas de forma adequada per una infotaula (parametre label)
-- S'usa a foncion claim amb case=infoboxlabel

local infoboxlabels = {
	["capital"] = "ciutat",
	["comunitat autònoma"] = "autonòmia",
	["departament francés"] = "departament",
	["districte francés"] = "districte",
	["estat federat alemand"] = "estat federat",
	["estat sobeiran"] = "estat",
	["reialme del Commonwealth"] = "estat",
	["republica"] = "estat",
	["zona de govèrn local d'Austràlia"] = "govèrn local"
}

-- Modificacions de las valors requeridas per una infotaula (paramètre de data)

local infoboxdata = {
	["American Society of Health-System Pharmacists"] = "ASHP",
	["Bach Werke Verzeichnis"] = "BWV",
	["desplaçament estandard"] = "estandard",
	["desplaçament en rosca"] = "en rosca",
	["desplaçament maximum"] = "maximum",
	["tonatge de pes mort"] = "DWT",
	["Còdi Internacional de Nomenclatura Zoologica"] = "CINZ",
	["Còdi Internacional de Nomenclatura Botanica"] = "CINB",
	["Còdi Internacional de Classificacion e Nomenclatura de Virus"] = "CICNV",
	["Còdi Internacional de Nomenclatura per las Plantas Cultivadas"] = "CINPC",
	["Còdi Internacional de Nomenclatura de Bacterias"] = "CINBa",
	["Còdi Internacional de Nomenclatura Botanica (edicion Viena)"] = "CINB (edicion Viena)",
	["Còdi Internacional de Nomenclatura Botanica (edicion Tòquio)"] = "CINB (edicion Tòquio)",
	["Còdi Internacional de Nomenclatura Botanica (edicion Saint Louis)"] = "CINB (edicion Saint Louis)",
	["International Code of Nomenclature for algae, fungi, and plants (edicion Melbourne)"] = "CINB (edicion Melbourne)",
	["genre masculin"] = "masculin",
	["genre feminin"] = "feminin",
	["Microsoft Windows"] = "Windows",
	["Modul de comanda e de servici Apollo"] = "CSM",
	["Modul lunar Apollo"] = "LM",
	["Berkeley Open Infrastructure for Network Computing"] = "BOINC",
	["enlairament"] = "Nau d'arribada",
	["aterratge"] = "Nau de retorn",
	["Advanced Packaging Tool"] = "APT",
	["GNU General Public License"] = "GNU GPL",
	["Common Development and Distribution License"] = "CDDL",
	["Associacion de Tennistes Professionals"] = "ATP",
	["Uninon Centre-Americana de Fotbòl"] = "UNCAF",
	["Federacion de fotbòl del sud-est d'Asia"] = "AFF",
	["Federacion de fotbòl de l'Oest d'Asia"] = "WAFF",
	["longor"] = "LOA",
	["longor de flotason"] = "LWL",
	["Estacion Espaciala Internacionala"] = "EEI",
	["Marina dels Estats Units d'Amèrica"] = "US Navy",
	["Kaiserliche und Königliche Kriegsmarine"] = "K.u.K. Marine",
	["escala d'huracans de Saffir-Simpson"] = "SSHS",
	["classificacion de tifons JMA"] = "JAM",
	["classificacion de ciclons IMD"] = "IMD",
	["classificacion de ciclons MF"] = "MFR",
	["classificacion de ciclons BOM/FMS"] = "BOM/FMS",
	["aterratge"] = "davalada",
	["exploracion de la superfícia"] = "exploracion",
	["Luna"] = "la Luna",
	["desplaçament normal"] = "normal",
	["sosmarin"] = "en immersion",
	["comanda"] = "autorizat",
	["barrinar"] = "barrinat",
	["mens que"] = "abans de",
}

-- Còdi de foncions de supòrt

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)
	if infoboxdata[label] then
		label = infoboxdata[label]
	else
		label = string.gsub(label, "^[eE]stacion de ", "")
		label = string.gsub(label, "^[eE]stacion d'", "")
		label = string.gsub(label, "^[eE]stacion del ", "lo")
	end
	
	return label
end

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