Moodul:Wikidata2/labels

Allikas: Vikipeedia

Selle mooduli dokumentatsiooni saab kirjutada asukohta Moodul:Wikidata2/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 = {
	["P40"]   = "Fills",                -- text adjusted for infobox                 infobox: persona
	["P57"]   = "Direcció",             -- text adjusted for infobox                 infobox: pel·licula, organització,.. 
	["P69"]   = "Formació",             -- text adjusted for infobox                 infobox: persona 
	["P97"]   = "Títol",                -- text adjusted for infobox                 infobox: persona
	["P102"]  = "Partit",               -- text adjusted for infobox                 infobox: persona
	["P136"] = "Gènere",                -- text adjusted for infobox                 infobox: organització
	["P138"]  = "Epònim",               -- text adjusted for infobox                 infobox: all
	["P150"]  = "Conté la subdivisió",  -- text adjusted for infobox                 infobox: geogr.política
	["P161"]  = "Papers destacats",     -- text adjusted for infobox                 infobox: persona
	["P166"]  = "Premis",               -- text adjusted for infobox                 infobox: all
	["P181"]  = "Distribució",
	["P186"]  = "Material",             -- text adjusted for infobox                 infobox: indret
	["P412"]  = "Veu",                  -- text adjusted for infobox                 infobox: persona
	["P417"]  = "Patrocini",            -- text adjusted for infobox                 infobox: geogr.política
	["P421"]  = "Fus horari",           -- text adjusted for infobox                 infobox: geogr.política
	["P571"]  = "Creació",              -- text adjusted for infobox                 infobox: organitzacio
	["P737"]  = "Influències",          -- text adjusted for infobox                 infobox: persona
	["P742"]  = "Altres noms",          -- text adjusted for infobox                 infobox: all
	["P800"]  = "Obres destacables",    -- text adjusted for infobox                 infobox: persona
	["P802"]  = "Alumnes",              -- text adjusted for infobox                 infobox: persona
	["P856"] = "Lloc web",              -- text adjusted for infobox                 infobox: pel·lícula
	["P915"] = "Rodatge",               -- text adjusted for infobox                 infobox: pel·lícula
	["P921"] = "Tema",                  -- text adjusted for infobox                 infobox: pel·lícula
	["P1038"] = "Parents",              -- text adjusted for infobox                 infobox: persona
	["P1120"] = "Morts",                -- text adjusted for infobox                 infobox: esdeveniments
	["P1066"] = "Professors",           -- text adjusted for infobox                 infobox: persona
	["P1191"] = "Estrena",              -- text adjusted for infobox                 infobox: pel·lícula
	["P1339"] = "Ferits",               -- text adjusted for infobox                 infobox: esdeveniments
	["P1411"] = "Nominacions",          -- text adjusted for infobox                 infobox: pel·lícula
	["P1412"] = "Llengua",              -- text adjusted for infobox                 infobox: all
	["P1446"] = "Supervivents",         -- text adjusted for infobox                 infobox: esdeveniments
	["P1559"] = "Nom original",         -- text adjusted for infobox                 infobox: all
	["P1672"] = "Font de",              -- text adjusted for infobox                 infobox: ésser viu
	["P2044"] = "Altitud",              -- text adjusted for infobox                 infobox: indret, geogr.política
	["P2048"] = "Alçada",               -- text adjusted for infobox                 infobox: persona
	["P2067"] = "Pes",                  -- text adjusted for infobox                 infobox: persona  
	["P2852"] = "Telèfon d'emergències", -- text adjusted for infobox                infobox: geogr.política
	["P3373"] = "Germans",              -- text adjusted for infobox                 infobox: persona
	["P4628"] = "Genoma",
	["Q7566"] = "Pares",                -- en:parents                                infobox: persona
	["Q1921834n"]  = "Característiques",  -- en:characteristics                       infobox: all
	["Q215972"]   = "Protagonistes",     -- en:protagonist                           infobox: pel·licula
	["Q7406919"]  = "Serveis",           -- en:services                              infobox: all
	["Q204711"]   = "FDA",     -- en:Food and Drug Administration                    infobox: fàrmac
	["Q4745081"]  = "AHFS",    -- en:American Society of Health-System Pharmacists   infobox: fàrmac
	["Q130146"]   = "EMEA",    -- en:European Medicines Agency                       infobox: fàrmac
    ["Q959782"]   = "Excavacions",       -- en:(archeological) excavations           infobox: indret
    ["Q55579539"] = "Activitat",         -- en:work period                           infobox: organització
    ["Q1207505"] = "Dades i xifres",     -- en:quality                               infobox: pel·lícula

    ["Q60313278"] = "Categoria:Articles de geografia política sense foto",  --       infobox: IGP

                            -- en:Category:Wikipedia requested photographs by administrative location   

	["T0001"] = "i",                    -- en:and (conjunction in lists)             infobox: all
	["T0002"] = "sense valor",          -- en:no value (as a property value)         infobox: all
	["T0003"] = "nou càrrec",           -- en:new position (no value in P39/P1365)   infobox: all
	["T0004"] = "eliminació càrrec",    -- en:ended position (no value in P39/P1366) infobox: all
	["T0005"] = "data desconeguda",     -- en:unknown date (as a property value)     infobox: all
	["T0006"] = "valor desconegut",     -- en:unknown value (as a property value)    infobox: all
	["T0007"] = "Descobriment del cos", -- en:discovery of body                      infobox: persona
	["T0008"] = "Es coneix per",        -- en:known by                               infobox: persona
	["T0009"] = "Idees notables",       -- en:remarkable ideas (philosophers, etc.)  infobox: persona
	["T0010"] = "Període en servei",    -- en:Period in service (military)           infobox: persona
	["T0011"] = "Supressió del culte",  -- en:end of worship (religion)         infobox: persona
	["T0012"] = "Continuadors",         -- en:disciples, followers (phil. relig, ..) infobox: persona
	["T0013"] = "Equip actual",         -- en:present team (sports)                  infobox: persona
	["T0014"] = "Retirada",             -- en:professional withdrawn (sports)        infobox: persona
	["T0015"] = "Estudiants notables",
	["T0016"] = "Altres estudiants notables",
	["T0017"] = "Assessorament acadèmic",
	["T0018"] = "Situació judicial",
	["T0019"] = "Enaltiment",
	["T0020"] = "Història i celebracions",
	["T0021"] = "Cota inicial",         -- en:starting spot height (river, walk)     infobox: indret
	["T0022"] = "Cota final",           -- en:ending spot height (river, walk)       infobox: indret
	["T0023"] = "Mars contigus",        -- en:adjacent seas (each side of a strait)  infobox: indret
	["T0024"] = "Ciutats riberenques",  -- en:riverside cities (of body of water)    infobox: indret
	["T0025"] = "Element vertebrador",  -- en:linking element (item and its environment) infobox: indret
	["T0026"] = "Cims destacats",       -- en:highlighted summits                    infobox: indret
	["T0027"] = "ANUL·LAT",             -- en:starting spot height (river, walk)     infobox: indret
	["T0028"] = "ANUL·LAT",             -- en:ending spot height (river, walk)       infobox: indret
	["T0029"] = "Ciutat més propera",   -- en:nearest city                           infobox: indret
	["T0030"] = "Mesures i indicadors", -- en:measures and indicators (section)      infobox: indret
	["T0031"] = "Mitjana de precipitacions", -- en:rainfall average                  infobox: indret
	["T0032"] = "Congelació",           -- en:freezing                               infobox: indret
	["T0033"] = "Tipus cascada",        -- en:Typus of waterfall (shape)             infobox: indret
	["T0034"] = "Alçada cascada",       -- en:Waterfall height (full falls)          infobox: indret
	["T0035"] = "Salt més llarg",       -- en:highlighted summits                    infobox: indret
	["T0036"] = "Dificultat",           -- en:difficulty (for tracks, climb,..)      infobox: indret
	["T0037"] = "Cultura/pobladors",    -- en:cultural/ethnic roots                  infobox: indret
	["T0038"] = "Tipus d'erupció",      -- en:kind of eruption (volcanic)            infobox: indret
	["T0039"] = "Última erupció",       -- en:last eruption (volcanic)               infobox: indret
	["T0040"] = "Pistes",               -- en:pistes (ski piste plural)              infobox: indret
	["T0041"] = "Ruta normal",          -- en:main itinerary (GR, trail, pathfoot)   infobox: indret
	["T0042"] = "Etapes",               -- en:stages (GR, trail, pathfoot)           infobox: indret
	["T0043"] = "Enllaç altres senders", -- en:link to other trails (GR, pathfoot)   infobox: indret
	["T0044"] = "Separació mínima",     -- en:minimum separation (straits),          infobox: indret
	["T0045"] = "Fusió de", -- en:amalgamation (entity "E" originated by merging "A"+"B") infobox: organitzacio
	["T0046"] = "Fusió amb",            -- en:Merge with (entity "E" merge with "A"+...)  infobox: organitzacio
	["T0047"] = "Refundació",           -- en:reconstruction  (entity second creation)    infobox: organitzacio
	["T0048"] = "Redissolució",         -- en:redissolved (to dissolve entity again)      infobox: organitzacio
	["T0049"] = "Àmbit",                -- en:thematic scope (library/museum area)        infobox: organitzacio
	["T0050"] = "Col·leccions",         -- en:collections (museum specific collections)   infobox: organitzacio
	["T0051"] = "Tipus de documents",   -- en:type of documents (in archive or museum)    infobox: organitzacio
	["T0052"] = "Préstecs anuals",      -- en:book loans by year (in library )            infobox: organitzacio
	["T0053"] = "Població potencial",   -- en:potential population (library, hospital,..) infobox: organitzacio
	["T0054"] = "Membres",              -- en:member (of the club/organitzation/society)  infobox: organitzacio
	["T0055"] = "Membres anteriors",    -- en:past members (music group/club/art school)  infobox: organitzacio
	["T0056"] = "Instruments destacats", -- en:featured instruments (music group)         infobox: organitzacio
	["T0057"] = "Persona clau",         -- en:keyperson (within the organitzation)        infobox: organitzacio
	["T0058"] = "Membres destacats",    -- en:remarkable members                          infobox: organitzacio
	["T0059"] = "cap de colla",         -- en:cap de colla (chief of castells team)       infobox: organitzacio
	["T0060"] = "Joventuts",            -- en:Youth Party (political party youth branch)  infobox: organitzacio
	["T0061"] = "Organització aliada",  -- en:allied organization                         infobox: organitzacio
	["T0062"] = "Organització rival",   -- en:rival organization                          infobox: organitzacio
	["T0063"] = "Xifres destacables",   -- en:remarkable figures (organitzation's indicators) infobox: organitzacio
	["T0064"] = "Altres dades",         -- en:Other information                           infobox: organitzacio, ICQ, Llibre
	["T0065"] = "Pais d'origen",        -- en:company estate (not the HQ, but the origin) infobox: organitzacio
	["T0066"] = "Organització i govern" -- en:type of organisation & management           infobox: organitzacio
}

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

local infoboxlabels = {
	["capital"] = "ciutat",
	["comunitat autònoma"] = "autonomia",
	["departament francès"] = "departament",
	["districte francès"] = "districte",
	["estat federat alemany"] = "estat federat",
	["estat sobirà"] = "estat",
	["reialme de la Commonwealth"] = "estat",
	["república"] = "estat",
	["zona de govern local d'Austràlia"] = "govern local"
}

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

local infoboxdata = {
	["American Society of Health-System Pharmacists"] = "ASHP",
	["Bach Werke Verzeichnis"] = "BWV",
	["desplaçament estàndard"] = "estàndard",
	["desplaçament en rosca"] = "en rosca",
	["desplaçament màxim"] = "màxim",
	["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",
	["Codi Internacional de Nomenclatura Botànica (edició Viena)"] = "CINB (edició Viena)",
	["Codi Internacional de Nomenclatura Botànica (edició Tòquio)"] = "CINB (edició Tòquio)",
	["Codi Internacional de Nomenclatura Botànica (edició Saint Louis)"] = "CINB (edició Saint Louis)",
	["International Code of Nomenclature for algae, fungi, and plants (edició Melbourne)"] = "CINB (edició Melbourne)",
	["gènere masculí"] = "masculí",
	["gènere femení"] = "femení",
	["Microsoft Windows"] = "Windows",
	["Mòdul de comandament i servei Apollo"] = "CSM",
	["Mòdul 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",
	["Associació de Tennistes Professionals"] = "ATP",
	["Unió Centreamericana de Futbol"] = "UNCAF",
	["Federació de futbol del sud-est d'Àsia"] = "AFF",
	["Federació de futbol de l'Oest d'Àsia"] = "WAFF",
	["eslora"] = "LOA",
	["eslora de flotació"] = "LWL",
	["Estació Espacial Internacional"] = "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",
	["classificació de tifons JMA"] = "JAM",
	["classificació de ciclons IMD"] = "IMD",
	["classificació de ciclons MF"] = "MFR",
	["classificació de ciclons BOM/FMS"] = "BOM/FMS",
	["aterratge suau"] = "descens",
	["Exploració de la superfície"] = "exploració",
	["Lluna"] = "la Lluna",
	["desplaçament normal"] = "normal",
	["sota l'aigua"] = "en immersió",
	["comanda"] = "autoritzat",
}

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

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