Vés al contingut

Mòdul:Infobox disease/prova/i18n

De la Viquipèdia, l'enciclopèdia lliure
local p = {}

--Warning: If an "Args" item has more one value: These values must be written between "{" and "}". More than two values are allowed.
local MLMT	= require "Module:Multilang module tools/prova"
local GIBTi	= require "Module:Global infobox tools/prova/items"
local GIBT	= require "Module:Global infobox tools/prova"
local MIBIi	= require "Module:Medical infobox items/prova/items"
local IDi = require "Module:Infobox disease/prova/items"

p.rs_val = { --reserved keys and their values for infobox configuration
	-- When here a value is nil or "", the used value is the value read from Global infobox tools/i18n.rs_val
	-- To see the values that these variables take, use |allitems=list
	--colors
	[GIBTi.rk.rs_colorbox]			= "", --color for title and headers
	[GIBTi.rk.rs_color_tit_cllps]	= "", --color for header of the collapsible text data
	--styles
    [GIBTi.rk.rs_bodystyle]			= "",
    [GIBTi.rk.rs_titlestyle]		= "", -- by default is rs_colorbox as background and centered text
    [GIBTi.rk.rs_headerstyle]		= "", -- by default is rs_colorbox as background 
    [GIBTi.rk.rs_subheaderstyle]	= "", -- by default is rs_color_tit_cllps as background and centered text
    [GIBTi.rk.rs_imagestyle]		= "", -- by default is padding-bottom:0.1em;line-height:1.35;font-size:98%
    [GIBTi.rk.rs_captionstyle]		= "", -- by default is padding-top:0.3em;padding-bottom:0.1em;line-height:1.35;font-size:98%
    [GIBTi.rk.rs_labelstyle]		= "", -- by default is text-align:start; padding-right:1.2em; background:#eeeeee (approx. silver)
    [GIBTi.rk.rs_datastyle]			= "", -- by default is text-align:start
    [GIBTi.rk.rs_belowstyle]		= "", -- 
    --icon
	[GIBTi.rk.rs_icon]				= "", -- filename of the icon that appears beside of the title
	[GIBTi.rk.rs_icon_at_begin]		= true, -- the position in relation to the title
	[GIBTi.rk.rs_icon_hint]			= "", -- by default is the template name, displayed when hovering over the icon with the mouse cursor 
	--image
	[GIBTi.rk.rs_image_max_num]		= 2, -- max number of images (1-2)
	[GIBTi.rk.rs_def_image_size]	= "", -- by default is 300x300px
	--referred to label/data content
	[GIBTi.rk.rs_changeable_lbls]	= false, -- if true, allows users to change the label text, using the next prefix:
	[GIBTi.rk.rs_param_prefix_lbl]	= "", -- by default is l_
	[GIBTi.rk.rs_def_charnum_cllps]	= 180, --number of characters from which the text will appear collapsed (for some label-data items)
	[GIBTi.rk.rs_below]        		= "", --fixed text (i.e. information) for for all the same infoboxes
}

p.items = { --This is (perhaps) the only table you need to modify to localize the content
	-- To see the current values for above variables use |allitems=list
	[MLMT.k.Args] = { -- alternative (localized) names for parameters
	--Warning: If an item has more one value: These values must be written between "{" and "}". More than two values are allowed.
		[GIBTi.rk.name]			= {"nom","Nom"},
		[IDi.k.type]			= "",
		[IDi.k.synonym]			= {"sinònim","sinònims","sinonim","sinonims"},
		[IDi.k.eponym]			= {"epònim","eponim"},
		[IDi.k.specialty]		= {"especialitat","camp"},
		
		[IDi.k.symptoms]		= {"símptomes","simptomes"},
		[IDi.k.complication]	= "complicacions",
		[IDi.k.onset]			= "debut",
		[IDi.k.duration]		= "durada",
		[IDi.k.types]			= "tipus",
		[IDi.k.causes]			= "causa",
		[IDi.k.risks]			= {"risc","riscs"},
		[IDi.k.diagnosis]		= "diagnosi",
		[IDi.k.exams]			= {"exàmens","examinacions"},
		[IDi.k.diff_diag]		= "diag_diferencial",
		[IDi.k.prevention]		= {"prevenció","prevencio"},
		[IDi.k.treatment]		= "tractament", --old: 7
		[IDi.k.drug_used]		= {"fàrmacs","farmacs"}, --Error en plantilla!
		[IDi.k.prognosis]		= {"pronòstic","pronostic"},
		[IDi.k.frequency]		= {"freqüència","frequencia"},
		[IDi.k.deaths]			= "morts",
		[IDi.k.d_burden]		= "carrega_malaltia",
		[IDi.k.measured_by]		= "mesurat_per",

		[IDi.k.location]		= {"localització","localitzacio"},
		[IDi.k.genetic]			= "associacio_genetica",
		[IDi.k.afflicts]		= "afecta",
		[IDi.k.transmitted]		= "transmissio_patogena",
		[IDi.k.has_cause]		= "causat_per",
		[IDi.k.has_effec]		= "causa_de",
		
		[IDi.k.ICD11]			= {"CIM11","CIM-11","CIE-11"},
		[IDi.k.ICD10]			= {"CIM10","CIM-10","CIE-10"},
		[IDi.k.ICD9]			= {"CIM9","CIM-9","CIE-9"},
		[IDi.k.ICD_O]			= {"CIMO","CIM-O"},
		[IDi.k.ICPC]			= "CIAP-2",
		[IDi.k.DSM]				= "",

		[IDi.k.OMIM]			= "",
		[IDi.k.OMIM_mult]		= "",
		[IDi.k.DiseasesDB]		= "",
		[IDi.k.DiseasesDB_mult]	= "",
		[IDi.k.MedlineP]		= "",
		[IDi.k.MedlineP_mult]	= "",
		[IDi.k.NCI]				= "",
		[IDi.k.P_UK]			= "",
		[IDi.k.Orphanet]		= "",
		[IDi.k.umls_cui]		= "",
		[IDi.k.doid]			= "",
	},
	[MLMT.k.Labels] = { -- alternative (localized) name to header/label returned from Wikidata 
	-- If possible, it is always best to modify the locazation in Wikidata	
		[IDi.k.type]			= "Tipus",
		[IDi.k.synonym]			= "[[Sinònim]]s",
		[IDi.k.eponym]			= "[[Epònim]]",
		[IDi.k.specialty]		= "[[Especialitat mèdica|Especialitat]]",
		
		[IDi.k.hd_Clinical]		= "Clínica",
		[IDi.k.hd_ClinicManag]	= "Clínica-tractament",
		[IDi.k.symptoms]		= "Símptomes", --old: 6, new 12
		[IDi.k.complication]	= "[[Complicació (medicina)|Complicacions]]",
		[IDi.k.onset]			= "Debut",
		[IDi.k.duration]		= "Durada",
		[IDi.k.types]			= "Tipus",
		[IDi.k.causes]			= "Causes", -- P1479 ? 
		[IDi.k.risks]			= "[[Factor de risc|Factors de risc]]",
		[IDi.k.diagnosis]		= "[[Diagnòstic mèdic|Mètode de diagnòstic]]",
		[IDi.k.exams]			= "Exàmens", --old: 11 
		[IDi.k.diff_diag]		= "[[Diagnòstic diferencial]]",
		[IDi.k.prevention]		= "Prevenció",	
		[IDi.k.treatment]		= "Tractament", --old: 7
		[IDi.k.drug_used]		= "Medicació", --old: 8
		[IDi.k.prognosis]		= "Pronòstic",
		[IDi.k.frequency]		= "Freqüència",
		[IDi.k.deaths]			= "Morts",
		[IDi.k.d_burden]		= "[[Càrrega de la malaltia|Càrrega]]", --old: 16
		[IDi.k.measured_by]		= "Mesurat per", --old: 17

		[IDi.k.hd_Pathos]		= "[[Patogènia]]", --new
		[IDi.k.location]		= "Localització",
		[IDi.k.genetic]			= "Associació genètica", --old: 9
		[IDi.k.afflicts]		= "Afecta", --old: 10
		[IDi.k.transmitted]		= "Transmissió patògena", --Transmès per ?? --old: 13
		[IDi.k.has_cause]		= "Causat per", --old: 14
		[IDi.k.has_effec]		= "Causa de", --old: 15
		
		--Old 32, 33, 34, etc.
		[IDi.k.hd_Classif]		= "Classificació",
		[IDi.k.ICD11]			= "[[CIM-11]]",
		[IDi.k.ICD10]			= "[[CIM-10]]",
		[IDi.k.ICD9]			= "[[CIM-9]]",
		[IDi.k.ICD_O]			= "[[Classificació Internacional de Malalties per Oncologia|CIM-O]]",
		[IDi.k.ICPC]			= "[[Classificació Internacional d'Atenció Primària|CIAP]]",
		[IDi.k.DSM]				= "[[DSM]]",
		
		[IDi.k.hd_ExtRes]		= "Recursos externs", 
		[IDi.k.OMIM]			= "[[Mendelian Inheritance in Man|OMIM]]",
		[IDi.k.DiseasesDB]		= "[[Diseases Database|DiseasesDB]]",
		[IDi.k.MedlineP]		= "[[MedlinePlus]]",
		[IDi.k.NCI]				= "[[National Cancer Institute|NCI]]",
		[IDi.k.P_UK]			= "[[Patient UK]]",
		[IDi.k.Orphanet]		= "[[Orphanet]]",
		[IDi.k.umls_cui]		= "[[Unified Medical Language System|UMLS]] [[Concept Unique Identifier|CUI]]",
		[IDi.k.doid]			= "[[Disease Ontology|DOID]]",
	},	
}

p.untranslat_args = { 
	--parameters to monitorize for untranslated words returned from Wikidata. 
	--article names are stored in rs_cat_wds_untranslat 
	IDi.k.specialty,
	IDi.k.symptoms,
}

------------------------------------------------------
-- OMIT PARAMETERS AND PRESET VALUES FOR PARAMETERS --
------------------------------------------------------

p.omit_params = {
	-- Key of standard params to omit
	-- When also change of the parameter order is required, the better solution is to use a new_idx
}

local NChars = GIBT.rs[GIBTi.rk.rs_def_charnum_cllps]
p.preset_params = {
	-- Key and a preset integer value
	-- Not used in this module
}

----------------------------------------
-- NEW ITEMS (non-standard) --
----------------------------------------

p.k = {
	-- definition of the keys of new items to use below, in format, i.g. name = "name"
	GEC_id		= "GEC_id",
	low_integer	= "low_integer",
	array		= "array",
}

p.new_items = {
	-- items to add
	[MLMT.k.Args] = {
		--[[
		Each item consists of:
		[key] = {"manual_parameter_name/s", "call to WD"},
		The first or second subitem can be omitted.	To omit a subitem means to leave it between "".
		"manual_parameter_name/s" can be "name" or {"name_1", "name2"}
		"call to WD" may be:
		  simple, e.g. "_P123456789" or
		  complex, e.g. {property = "P123456789", formatting = "[http:/web/$1 $1]", ...}		
		--]]	
		[p.k.GEC_id] = {"",	{property="P1296", 
							formatting='[https://www.enciclopedia.cat/ec-gec-$1.xml $1]'}},
		[p.k.low_integer] = {"low_integer", ""},				
		[p.k.array] = {"array", ""},
	},	
	[MLMT.k.Labels] = {
		--[[
		Each item consists of:
		[key] = "label",
		"label" must be:
		  a text or 
		  a call to WD, e.g. "_P123456789"
		--]]	
		[p.k.GEC_id] = "[[Enciclopèdia Catalana]]",
		[p.k.low_integer] = 'Lower integer',
		[p.k.array] = '_Q44337',
	},
}

p.new_lims = {
	--[[
	It is an optional table to set parameter types for a new_args. 
	    type of the parameter. Usually types are: "s" or string, "i" or integer, "n" or number, "b" or boolean. 
			The numeric parameters can add "+" for positive value.
		By default the parameter type is a string ("s")
	e.g. {new_item,	'i'},
    --]]
	[p.k.low_integer]	= {'i',{0,2}},
	[p.k.array] 		= {"a", {"one","two"}},
	[IDi.k.proof_arg]	= {'a',{'c','d'}},
	--[p.k.low_integer]	= 'i+',
}

function p.local_func (frame, args)
-- Only use this function for localized parameters
-- "frame" sometimes is required for a function (see below)
-- "args" contains all parameters and its values
	vals = {} -- ← Do not delete or change this line!
	--[[
	--"vals" is a table that will contain none to several items.
		--where EACH item contains the name of target standard parameter and its value 
	result_for_this_param = 
		"result_for_this_param" contains the value for one item.
		1. if you know how to program minimally with lua:
		    e.g. for two lines: args("param_1")..'</br>'..args("param_2")
		2. a call to a module:    
			require("Module:Module_name_to_call").called_function (parameter_list)
			parameter_list is the list of the comma separated parameters an between "{}":
				e.g. {separator='<br>', args("param_1"), args("param_2")
		3. if you don't know how to program or a template is a better solution:
			frame:expandTemplate {
				title = "template_name", --template_name is the name of the used template, it must be write between "". e.g. "My template"
				args = {the_args} -- "the_args" are the parameters passed to the used template
				                  -- e.g: {args("param_1"), args("param_2")}, where "param_1" and "param_2" are the name of two localized parameters
				} <-the last curly bracket
				also you can read: https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#frame:callParserFunction
	table.insert (vals, {target_param_name, result_for_this_param}) --It adds one item with the target parameter and a previous set value
	         "target_param_name" is the name of a target standard parameter
	e.g. for several values:
		result_for_this_param = args("param_1")
		table.insert (vals, {target_param_name_1, result_for_this_param})
		result_for_this_param = '<b>''..args("param_2")..'</b>' --always appears in bold
		table.insert (vals, {target_param_name_2, result_for_this_param})
	--]]
	result_for_this_param = args(p.k.GEC_id)
	table.insert (vals, {p.k.GEC_id, result_for_this_param})
	result_for_this_param = args(p.k.low_integer)
	table.insert (vals, {p.k.low_integer, result_for_this_param})
	result_for_this_param = args(p.k.array)
	table.insert (vals, {p.k.array, result_for_this_param})
	return vals -- ← Do not delete this line!
end --local_func

-- WARNING!: p.new_idx is a duplicated table of IDi.idx, and this replaces IDi.idx
p.new_idx = {
	{'a',  GIBTi.rk.name},
	{'-',  GIBT.images},
	{'al', IDi.k.type},
	{'al', IDi.k.synonym},
	{'al', IDi.k.eponym},
	{'al', IDi.k.specialty},
	
	{'L',  IDi.k.hd_Clinical},
	{'L',  IDi.k.hd_ClinicManag},
	{'al', IDi.k.symptoms},
	{'al', IDi.k.complication},
	{'al', IDi.k.onset},
	{'al', IDi.k.duration},
	{'al', IDi.k.types},
	{'al', IDi.k.causes},
	{'al', IDi.k.risks},
	{'al', IDi.k.diagnosis},
	{'al', IDi.k.exams},
	{'al', IDi.k.diff_diag},
	{'al', IDi.k.prevention},
	{'al', IDi.k.treatment},
	{'cl', IDi.k.drug_used},
	{'al', IDi.k.prognosis},
	{'al', IDi.k.frequency},
	{'al', IDi.k.deaths},
	{'al', IDi.k.d_burden},
	{'al', IDi.k.measured_by},

	{'L',  IDi.k.hd_Pathos},
	{'al', IDi.k.location},
	{'al', IDi.k.genetic},
	{'al', IDi.k.afflicts},
	{'al', IDi.k.transmitted},
	{'al', IDi.k.has_cause},
	{'al', IDi.k.has_effec},

	{'L',  IDi.k.hd_Classif},
	{'al', IDi.k.ICD11},
	{'al', IDi.k.ICD10},
	{'al', IDi.k.ICD9},
	{'al', IDi.k.ICD_O},
	{'al', IDi.k.ICPC},
	{'al', IDi.k.DSM},

	{'L',  IDi.k.hd_ExtRes},
	{'al', p.k.GEC_id},
	{'al', p.k.low_integer},
	{'al', p.k.array},
	{'al', IDi.k.OMIM},
	{'a',  IDi.k.OMIM_mult},
	{'al', IDi.k.DiseasesDB},
	{'a',  IDi.k.DiseasesDB_mult},
	{'al', IDi.k.MedlineP},
	{'a',  IDi.k.MedlineP_mult},
	{'-',  MIBIi.k.eMed},
	{'al', IDi.k.NCI},
	{'al', IDi.k.P_UK},
	{'-',  MIBIi.k.Mesh},
	{'-',  MIBIi.k.Gene},
	{'al', IDi.k.Orphanet},
	{'al', IDi.k.umls_cui},
	{'al', IDi.k.doid},
	{'al', IDi.k.proof_arg},
}

return p