Ajuda:Multilanguage infoboxes
The Multilanguage infoboxes project aims to create a set of wikidata-powered, easy to localize Infoboxes for use in any wikipedias.
They work by filling in the parameters for an {{infobox}}, mostly label, data and header. The generation of the parameters can be:
- Direct, which we will call "lua-only" modules.
- Indirect, through one -or more- templates. We call these secondary templates "preinfobox".
Both modes are based on the construction of three modules, based on Module:Global infobox tools.
This set allows easy localization of the infoboxes; and thus adapt to any Wikipedia.
The following discussion contains some comments on Lua syntax, which may come in handy to understand the source code of the modules in case you need to go beyond localization and add features to the standard infobox.
Introduction
[modifica]Multilingual Infoboxes:
- They allow easy translation (otherwise called localization) of the denomination of:
- the labels (and headings), replacing the default English labels.
- of parameter names (otherwise called argument), complementing the default English names.
- In some cases, specific (and separately from the previous ones) specific messages of the infobox are considered.
- Two modes of data collection for the infobox items:
- Manual: The default mode of filling the item values. It is maintained by:
- Compatibility with articles that already have infoboxes with manually assigned elements.
- Items that do not have a property similar to Wikidata (WD) or that the contents of the WD value are unsatisfactory and/or inappropriate to modify there.
- Automatic: reading the values of the qualifiers or properties contained in WD, referring to the labels or specific values of the infobox for a specific article (data). That is why in articles, the article must be connected to the corresponding WD element. The data value obtained from WD (or each of the values obtained from a list) contain links to WD and the article if it exists. The auto-return of a WD value can be omitted by setting it to NONE.
- Manual: The default mode of filling the item values. It is maintained by:
- Obviously if a manual value is not assigned to an element and this element does not find a value assigned to this property in WD, then no label will be displayed.
- Checking:
- In the case of the construction or modification of the infotables, the various lists used for labels, parameters, etc.
- Of possible duplications in the denomination of the parameters.
- Previous, for data values entered manually for some parameter types. For example, it can verify that an entry that needs to be numeric is numeric and within a certain range of values.
- The existence of parameter names or their duplicity, if any:
- An error message will appear in preview mode.
- The name of the article in one/two maintenance categories will be noted for verification by the administrator.
- Demo infoboxes:
- From all parameters, where the data corresponds to the parameter names.
- The call is
demo=true
. - The data values will be presented with the denomination of the corresponding parameter; the chosen denomination will be the first of the possible translated denominations (if there is more than one), the translated denomination if there is only one or the default English denomination. The font color will be brown if there is no WD call or blue if there is one.
- The call is
- From chosen parameters, from a real case by calling WD and indicating the identification number (
|item=
). The chosen parameters will be followed by their comma-separated names and after|proof_params=
.
- From all parameters, where the data corresponds to the parameter names.
- Lists to facilitate the task of checking the translation. For more details look at here.
- Generation of the code of TemplateData. The call is
allitems=template
. The sort order is the same as the order list. - Security and flexibility: Its modular structure has made it possible to encapsulate what (several pages) should not be modified (to be standard) of what can be modified without affecting the standardized operation of the rest.
- Greater security: The appropriate checks are made to detect errors (and thus notify these errors) that may occur in the location or in more complex modifications, made by the administrator of the infobox.
- Compartmentalized flexibility: Allows limited (in preinfobox mode) and extensive (in only-lua mode) modifications of functionality to adapt to some peculiarities of some Wikipedias, without modifying the core.
Wikipedia modules, how can it be otherwise, are written in lua (a programming language). To make the locations you do not need to know this language or know how to program, just look at the labels and parameter names, that already exist, and modify only what is needed, as explained below.
I just want to translate the infobox
[modifica]1. It is necessary to install all the pages of the template including the requested modules.
2. Is there an infobox like this on my Wikipedia?
- Yes: You will probably need to add the existing parameter names to your Wikipedia language. You will probably need to translate some labels that appear in the infobox into your language.
- No: You only need to translate some labels. Then think about the convenience of incorporating manual parameters and their naming.
Installation
[modifica]In case any module is missing appears a message like: Lua error in package.lua appears in line nn: module 'Module:ModuleName' not found.
Localization
[modifica]Part of the localization is automatic, based on the existing translation into your language of some labels in WD; however, it will be necessary to review the names for the parameters.
Non-automatic or non-automatic translations from WD should be noted in the i18n suffix modules. The other types of modules should never be modified, only for possible updates.
If this is the first multilanguage infobox to use in your Wikipedia, it will be necessary to translate not only the parameters and labels of the current infobox, but also the following modules:
In the localization process you can alternate the localization result with the revision of the lists, as discussed below:
Localization result
[modifica]You can try how the infobox is displayed on your Wikipedia with:
{{#invoke:ModuleName|infobox|demo=true}}
or specifically with
{{#invoke:ModuleName|infobox|item=Qnnnnn}}
where Qnnnnn
is the Wikidata code for the article whose infobox you want to see by reading the infobox items present from there. All items have a WD code (except newly created ones). You can find this code by activating the Wikidata item or similar command name, located in the sidebar.
Lists
[modifica]How to remember the types of lists:
All items
[modifica]This is perhaps the most practical way to display reserved variables, parameters, and labels ({{#invoke:ModuleName |infobox|allitems=all}}
).
Labels
[modifica]To see the labels you want to translate ({{#invoke:ModuleName|infobox|allitems=labels}}
):
Note that there is a central column titled WD
and the next one titled WD content ()
. Then:
- If a translation does not appear you can add. To add: clicking in the link of the WD column, then in WD page you can add the translation.
- If you don't like the translation in the infobox, you can modify it in WD (but without changing the meaning of the translation!). If you want a label to be different, you need to make a change to the i18n module, specifically to:
p.items = {
....
[MLMT.k.Labels] = {
....
},
}
Parameter list
[modifica]If you want to add new names for the manual parameters (which are in English), first of all to see which ones you have ({{#invoke:ModuleName|infobox|allitems=params}}
):
To add it, make a change to the i18n module, specifically to:
p.items = {
[MLMT.k.Args] = {
....
},
....
}
How to omit some items from appearing
[modifica]When you do not want one or more elements to appear (the value of a parameter and, usually, the label that presents it), two areas can occur:
- . That the infobox administrator considers that they should not appear.
- . That an editor considers that they should not appear in a particular article.
In 1. you need to add the item key in the omit_param
table of the i18n module. An example would be (where TIi
would be the abbreviation of the Module:This infobox
, called at the beginning as in the previous items
table):
local TIi = required "Module:This infotable/items"
p.omit_params = {
-- Key of standard params to omit
AIi.k.name,
}
When it is a only-lua infobox and you also want to change the order of the elements, then the best solution is to change the elements in the new_idx
table of the same module.
In 2. the editor can prevent an item that automatically reads WD content from doing so. So you just need to assign NONE as a value for that element.
Preassignment of alternate numeric values
[modifica]It can rarely be useful to assign other defaults to a specific parameter in an infobox. To do this, enter the key of the parameter followed by the value to be assigned to it and in the preset_params
table of the i18n module. An example would be the number of characters that determines whether or not a drop-down text is displayed. With an example:
p.preset_params = {
-- Key and a preset integer value
[PiPi.k.cllps_member_of] = 330,
}
Preinfobox or only-lua mode?
[modifica]If you want to migrate from conventional to multilingual infotables, these two systems have advantages and disadvantages, looking at the differences:
Preinfobox
[modifica]- No need to know lua.
- Most pages (5)
- In location (i18n):
- Order changes are not allowed.
- Non-standard parameters only allow merging or sending results to an existing parameter. Creating headers or tags is not supported.
Only-lua
[modifica]- You need to know a little lua to get the best results.
- Lower number of pages (3), faster execution and less possibility of errors in its design.
- In the creation: the position indicates the order of display in the infobox, avoiding to have to number the head, label and data tags for infobox.
- It allows modular design, incorporating modules that can be shared with other infotables. An example is the image module, whose values the infotables incorporate at the top of the infobox.
- In location (i18n):
- Creation of parameter, heading and label non-standard are supported, with almost the same functionalities as the standard ones.
- Changes in the order of the items can be established, without having to worry about numbering.
- Automatic review of the data content returned from WD without translation into the localized language. With free choice of the chosen parameters to review. The results of the review are noted on a maintenance page.
Structure
[modifica]As shown in the preceding image the call from the template to an infobox is made to a preinfobox or only-lua modules, which are the two existing modalities.
To understand some of the explanations that follow it is best to understand some basic concepts of lua syntax and that you can find here, towards the end.
In the case of both (the preinfobox and the only-lua module) share many similarities, which makes it possible to identify three modules. There will be three modules. If we call "Main" in the main module (for the following explanation), then they will be:
- Main infobox, or "Main". Labeled (in the above diagrama) as Preinfobox or Infobox only-lua.
- "Main/items", with the definition of:
- Parameter and label names,
- List of unusual parameter types (integer or real numbers, date and boolean).
- Items list of parameters (or arguments) and labels.
- "Main/i18n", with the location, as it is considered appropriate of:
- Modification of defaults, such as the color or icon of the infobox (see the below, to see the ones used in the Catalan Wikipedia).
- Parameter names.
- Label names.
- Definition of non-standard parameters, defining their functionality.
Important: The explanations that follow are for interpreting the lua code of what has just been said. But you do not need to know how to program.
In the middle of the lua code they follow, comments appear after "--".
For the construction of an infobox that uses modules, these required modules require others of less specific use.
SimpleDebug
[modifica] SimpleDebug, in addition to helping in debugging modules, is dedicated to improving the presentation of error messages. Errors that can occur when an administrator localizates an infobox (when modifying an i18n file) or when there are modifications to the lua code carried out by a programmer who modifies the standard version. Abbreviated as SD
.
SimpleArgs
[modifica]SimpleArgs (with its i18n module) contains functions to check parameters and to handle error messages. Abbreviated as SA
.
Multilang module tools
[modifica]This module is used for multilingual modules whether or not they are infotables like the one being discussed here. Abbreviated as MLMT
.
Wikidades
[modifica]Aquest mòdul (with its i18n module) contains WD property reading and qualifier functions.
Global infobox tools modules
[modifica]This module, items and i18n) contain variables and functions for designing pre-table or single-moon infobox modules. Abbreviated as GIBT
, GIBTi
and GIBTi18n
respectively.
Among the main variables it contains:
- All or most of the reserved variables, as parameters that cannot be modified by users and that determine a homogeneous appearance for the same infobox group. Among these variables are those that determine the color of titles and headings or the name of maintenance categories.
- Image parameters, depending on whether one or two images are supported for each infobox.
Global infobox tools/i18n
[modifica]Contains the default values for ALL multilingual infoboxes.
For the reserved variables:
local center = "valign=center; padding:1px;"
local direct = 'right'
if MLMT.LangIsRTL then
direct = 'left'
end
p.rs_val = { --
-- To see the values that these variables take, use |allitems=list
--styles
[GIBTi.rk.rs_bodystyle] = "",
[GIBTi.rk.rs_titlestyle] = center, -- it will added at begin the rs_colorbox of the specific infobox
[GIBTi.rk.rs_headerstyle] = "", -- it will added at begin the rs_colorbox of the specific infobox
[GIBTi.rk.rs_subheaderstyle] = center, -- it will added at begin the rs_color_tit_cllps of the specific infobox
[GIBTi.rk.rs_imagestyle] = "padding-bottom:0.1em;line-height:1.35;font-size:98%",
[GIBTi.rk.rs_captionstyle] = "padding-top:0.3em;padding-bottom:0.1em;line-height:1.35;font-size:98%",
[GIBTi.rk.rs_labelstyle] = "padding-"..direct..":1.2em;background:#eeeeee; text-align:start",
[GIBTi.rk.rs_datastyle] = "text-align:start",
[GIBTi.rk.rs_belowstyle] = "",
--icon
[GIBTi.rk.rs_icon_at_begin] = true, -- the position in relation to the title
--image
[GIBTi.rk.rs_image_max_num] = 1, -- max number of images (1-2)
[GIBTi.rk.rs_def_image_size] = "300x300px",
[GIBTi.rk.rs_send_img_preinfobox] = false, -- only used by preinfoboxes, if true read from WD the values and more (read info)
--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] = "l_",
[GIBTi.rk.rs_def_charnum_cllps] = 180, --number of characters from which the text will appear collapsed (for some label-data items)
}
Main module/items
[modifica]Definition of the used keys
[modifica]The keys are defined in a lua table. This table is named k
for key.
p.k = {
name1 = 'name1',
name2 = 'name2',
...
}
The keys must match some key features. In the example: name1
is a key and 'name1'
is a lua string.
name1
stores the value 'name1'
.
Each key name can correspond to the name of a parameter, a label, both, or, rarely, a message. Names for header label keys have hd_
as prefix.
For the operation the order in which the items are placed is indifferent (since it does not establish the definition per se an order), but they are placed by order of appearance in the infobox (order that will be repeated in the index that continues below).
Some modules may also define keys of specific reserved variables, specific to the infobox. These keys are rs_
as prefix and are inside a table named krs
.
Parameter types assignment
[modifica]Optionally, assignment of the checking of the entered values according to the parameter type and restrictions:
p.arg_lims = {
[p.k.name1] = 'i', --indicate that name1 must be an integer
[p.k.name2] = 'n', --indicate that name2 must be a number
[p.k.name3] = {'i', {2,10}}, --indicates that name3 must be an integer between 2 and 10, both included
[p.k.name4] = 'b', --indicate that name4 must be a boolean
[p.k.name5] = {'a', {'AM','PM','??'}}, --indicate name5 must be a value from 'AM','PM' i '??'
....
}
We say optionally since it is not necessary to write down any variable if, as usual, it is a string.
Other parameter types would be: i+
or n+
for a positive integer or a positive number, respectively.
Parameters to check the translation (lua infoboxes only)
[modifica]It is a (optional) table that indicates the parameters that will be reviewed if any words or text (returned from WD in the infobox) are missing to translate into the language of the wiki. (See in the main module, below, how to assign the maintenance category). It will look similar:
p.untranslat_args = {
p.k.name1,
p.k.name4,
}
If you do not want to review, leave it blank, like this:
p.untranslat_args = {}
Order of label-parameter items
[modifica]It is important in the presentation of the list (or lists) that are shown in the infobox help documentation; and only in the case of an infobox built entirely with lua by the order in which the items will appear in the infobox.
It consists of the following names of parameters:
p.idx = {
{'al', p.k.name1},
{'al', p.k.name2},
....
}
Where 'al' is one of the label-parameter types following types in the following section:
In i18n:
- In the only-lua infobox, the order of the items can be altered, including new items or deleting others.
- In the preinfobox, the only order of the new parameters can be determined, look at here.
Main module
[modifica]It consists of two main parts:
- the statements (their composition) of the parameters and labels.
- the program itself.
Statements
[modifica]1. Usual reserved variables. The colors and the icon are typical, for these a function already exists, and in this example it takes science
as value of the colors group and medical_condition
as the icon key.
GIBT.SetColorsAndIcon ( --set 3 usual reserved keys
GIBTi18n.lcol.science, --group color
GIBTi18n.licon.medical_condition) --icon key, and optional hint
It is followed by the other less common values that need modification, assigned within a table:
local rs = { --reserved keys and their modified values for infobox configuration
--for default stored values of the other options look at list with allitems=list
}
2. In some cases, specific reserved variables, of the infobox.
local rss = { --reserved keys and their values for this infobox (specific)
[ModuleItemsAbbrev.krs.rs_...] = ....,
}
3. Definition of maintenance categories. The most common is the errors in the parameters.
local cat = { --tracking categories
[GIBTi.rk.rs_cat_arg_error] = "_Qnnnnnnnn",
}
4. Parameters and lables. These include MLMT.k.Args
= 'Args' (or parameters, corresponding to the data
of the infobox
) and MLMT.k.Labels
= 'Labels' (or tags). The tags correspond to the header
or the label
of the infobox
.
local i18n = {
[MLMT.k.Args] = {
[IPi.k.education] = {"education", "",}, - "" indicates that the parameter can only be entered manually
[GIBT.k.image] = {{"image", "Image"}, "_P18",}, - "_P18" indicates that it will search for the image in the P18 property of the element in WD.
....
},
[MLMT.k.Labels] = {
....
[IPi.k.component] = "_Q1310239", - "_Q1310239" indicates that it will search for the label on item Q1310239 in WD.
[IPi.k.canonization_by] = "Canonization by", - No tag for this value and assigns it directly.
},
}
Let's look at two parameters from the example:
IPi.k.education
: Has only one possibility of pre-assigned name as a parameter ("education"
)GIBT.k.image
: has two pre-assigned name possibilities, so they are written between{}
, so{"image", "Image"}
.
Later in the i18n other localized values can be assigned for these parameter names or labels.
Program
[modifica]It consists of two fundamental parts:
- The call to the lists.
- Reading the values of the past parameters and:
- In a preinfo table: sending the values to the template. Because there are usually cases where there is a label and an associated value, they are sent to the template:
lbl_name=Label
, for the label according to the defined Qnnnnn, otherwisel_name=Alternative label
can be used to use an other label than the one returned by the Qnnnnn in a particular special article.val_name=value
for the value of the parameter, if it has been assigned manually, andval_name=NONE
if the article editor wants a parameter not to use the automatic reading of WD.
- In a complete module: sending the values to the infobox module.
- In a preinfo table: sending the values to the template. Because there are usually cases where there is a label and an associated value, they are sent to the template:
Main module/i18n
[modifica]Has:
Default values
[modifica]At the beginning of this module you can see the change values of the pre-assigned values (of reserved variables) of the infobox, under the rs_val
label, it can look like this:
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] = nil, -- 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] = 1, -- max number of images (1-2)
[GIBTi.rk.rs_def_image_size] = "", -- by default is 300x300px
[GIBTi.rk.rs_send_img_preinfobox] = false, -- only used by preinfoboxes, if true read from WD the values and more (read info)
--referred to label/data content
[GIBTi.rk.rs_changeable_lbls] = nil, -- 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] = nil, --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
}
Just as GIBTi.rk.rs_colorbox = ""
means that the infobox color is not changed, and the value set in Main module will be used.
Locating parameters and labels
[modifica]p.items = {
[MLMT.k.Args] = {
[GIBT.k.image] = "imatge", -- this is the name in creator's language for image
....
},
[MLMT.k.Labels] = {
....
[GIBT.k.component] = "", --no alternative label is provided to the one already providing the call to WD.
[IPi.k.canonization_by] = "Canonitzat per", --a value is provided for the tag as there is no value to return from WD.
},
}
Other items
[modifica]Which are specific, for creating non-standard parameters, look here:
Reserved variables
[modifica]Among the parameters are some that will be treated differently and that correspond to values that will only be modified by the administrator of the infobox. These parameters will be the name prefixed with rs_
(from reserved). These parameters are not included in the i18n as the translation does not make sense. Their values can be seen in the generated lists of parameters and labels. Let's look at a couple, defined in main module:
Reserved key | Definition | Default value |
---|---|---|
Colors | ||
rs_colorbox |
Color for the headers | - none: transparent -- Can be assigned with GIBT._GetInfoboxColor (GIBTi18n.lcol. group_name,1) or better with GIBT.SetColorsAndIcon .Look at #Colors for titles |
rs_color_tit_cllps |
Here tit means title and cllps collapse Color for heading a collapsible text |
- none: transparent - To set with GIBT._GetInfoboxColor (GIBTi18n.lcol. group_name,2) or better with GIBT.SetColorsAndIcon .Look at #Colors for titles |
Styles | ||
rs_bodystyle |
Body style | -- |
rs_titlestyle |
Title style | background:colorbox i text centratPreval sobre colorbox
|
rs_headerstyle |
Header style | background:colorbox Preval sobre colorbox
|
rs_subheaderstyle |
Styles for the subheader and collapsible text header | background:color_tit_cllps Preval sobre color_tit_cllps
|
rs_imagestyle |
Image caption style of a text returned from WD | padding-bottom:0.1em;line-height:1.35;font-size:98% |
rs_captionstyle |
Image caption style | padding-top:0.3em;padding-bottom:0.1em;line-height:1.35;font-size:98% |
rs_labelstyle |
Label style | padding-right:1.2em; background: |
rs_datastyle |
Data style | -- |
rs_belowstyle |
Footer style of the fixed text of infobox (rs_below ) |
-- |
Icon | ||
rs_icon |
Icon name. Icon displayed in the title bar of the infobox. | Some of the preset icons you can find at the end may have been assigned (Icons for titles). Can be assigned with with GIBT.SetColorsAndIcon . If you do not want to display the preset icon for a specific infobox, and not replace it with another icon, type "NONE".
|
rs_icon_at_begin |
Determines whether the mentioned icon is displayed before (therefore true) or after the title (false). In right-to-left languages "at_begin" means, logically, to the left. | Before ( true ) |
rs_icon_hint |
Message displayed when hovering the mouse cursor over the icon | Template name. The message can be changed or make it not appear with "NONE" |
Image/s | ||
rs_image_max_num |
Maximum number of automatically images allowed, entered manually or returned from WD. Remember that it is probably always best to assign it manually. | 2 |
rs_def_image_size |
Default size of the image/s. That adjusts to the width of the infobox, as the value is usually limited in width; but a maximum value can also be set for the height, with the format {width}x{height}px | 300x300px |
rs_send_img_preinfobox |
Only used for preinfoboxes:
|
false |
Others | ||
rs_changeable_lbls |
If set to true, it will allow the user to change the label text. In this case, and for example, if a label is named "label" and displays "Label", if the user manually indicates l_label=Other , the infobox will display "Other" |
true |
rs_param_prefix_lbl] |
Prefix to identify the labels that the user can modify according to the previous variable | "l_" |
rs_def_charnum_cllps |
Where def is default, charnum is characters number and cllps is collapse; which is the default number of characters from which the text will appear collapsed under the title-label that heads the text. |
180
(corresponds approximately to 3 lines) |
rs_below |
Usually a fixed text for all infoboxes, for example some Wikipedias in the disease infobox have a warning saying that Wikipedia is not a place to know what one has or to find treatment; or indicates that it is the Medicine Access. |
Of error and maintenance:
Reserved key | Definition | Link to WD for its localized and/or specific value |
---|---|---|
categ_arg_dupli |
Category name. Category where articles with a duplicate article name are noted in the infobox. As it is a very rare case, all the infoboxes that use the system in the same category are assigned. | Categoria:Pàgines amb arguments duplicats en utilització de plantilles (Q89919289). |
error_arg_category |
Category name. Category where articles with an erroneous article name are noted in the infobox. | By example: Q90498582 (Q90498582), but that will vary depending on the infobox. |
error |
Label that appears at the end of the infobox when there is one of two errors defined above. | Error (Q29485). |
Error categories must be created in order to display them with content similar to:
{{Maintenance category}}
{{Notice|List of pages automatically generated from {{tl|Infobox...}} of articles containing .... Updating the list is not immediate unless the article has just been edited.
__HIDDENCAT__
[[Category:Infoboxes with unknown parameters]]
Here you can find the name of the template in Plantilla:Categoria no enciclopèdica (Q5618182) and the category in Categoria:Infotaules usades amb paràmetres desconeguts (Q56486184).
For the infoboxes in lua you can also find:
[GIBTi.rk.rs_categ_wds_untranslat] = {"categor_wds_untranslat", "_Q90778219",},
categ_wds_untranslat
, is the category where articles are written that have a word or text returned from WD that is not translated into their own language. The category must be defined in the WD by the specific location, you can access it by clicking (in this example) on Q90778219 (Q90778219).
The list of parameters to review is described in main/items.
Parameter types
[modifica]The parameters are usually treated as strings and there is no check; but infoboxes allow to assign special types and constraints for parameter values:
Type | Key | Observations |
---|---|---|
String | s |
is assigned by default |
Real number | n |
n+ for the positives
|
Enter number | i |
i+ for the positives
|
Data | d |
only taken into account by TemplateData |
Boolean | b |
yes-no, true-false, etc. |
Size | sz |
(sz = size), positive integer followed by em or px
|
Array | a |
string to choose from a possible array of values |
For limits for the numbers are required the upper and lower limit within a table. For example: {1,10}
, then there can also be a type to include in a table, as well as: {'i', {1,10}}
or {'n', {0.1,9.9}}
.
Array item values must be included in a table. For example: {'a', {'north','south','east','west'}}
.
Image parameters
[modifica]Located in the subtable MLMT.k.Args
.
Table | KeyGIBTi.ik |
Names |
---|---|---|
i_items1 |
image |
image, Image |
image_idx |
image_idx | |
alt |
alt | |
size |
size, width | |
caption |
caption, Caption | |
i_items2 |
image1 |
image, Image, image1, Image1 |
image_idx1 |
image_idx1 | |
alt1 |
alt, alt1 | |
size1 |
size, width, size1, width1 | |
caption1 |
caption, Caption, caption1, Caption1 | |
image2 |
image2, Image2 | |
image_idx2 |
image_idx2 | |
alt2 |
alt2 | |
size2 |
size2, width2 | |
caption2 |
caption2, Caption2 |
Types of lists
[modifica]In order to facilitate the localization, the lists are displayed with a table of sortable rows (and sorted, initially, in order of appearance in the infobox). They are shown:
- the key,
- as noted in the table below: text for tags, reserved words, or parameter names,
- the properties or qualifiers of WD used and
- localization: either the value returned by WD or annotated in the i18n module.
The three types of lists are usually shown in the template and module documentation:
What is listed | Call |
---|---|
Reserved variables, parameters and labels | allitems=list
|
Parameters | allitems=params
|
Labels | allitems=labels
|
Some concepts of lua
[modifica]Key features
[modifica]A key is simply the name of a variable in lua. Like this:
- Each variable in the name only supports characters from
a
toz
,A
toZ
,_
, and non-initial ciphers. - IMPORTANT: in lua it is taken into account if a character is uppercase or lowercase. Thus
name1
is not the same asName1
.
For those with some knowledge of moon programming there is no distinction between constants and variables or in other words: both are variables.
Lua string
[modifica]Strings are always defined between "
or '
, indiscriminately (but not simultaneously).
Thus, a =
is used to assign the string "name1"
to the variable n
.
So n = "name1"
is the same as typing n = 'name1'
. But n = "name1'
is incorrect.
Lua table
[modifica]A table is simply a collection of items.
It simply consists of a name and a serie of comma-separated items, for example:
digits = {1,2,3,4,5,6,7,8,9}
Complicating the thing: each of the items can have name or be a table itself. For example:
countries = {
["Europa"] = {"Albania", "Andorra", "Armenia", ...},
["Asia"] = {
["Central Asia"] = {"Kazakhstan", "Kyrgyzstan", "Tajikistan", ...},
["East Asia"] = {"China", "Hong Kong", "Macau", ...},
...
},
...
}
Or what is the same:
k = {
Europe = "Europe",
Asia = "Asia",
Central_Asia = "Central Asia",
East_Asia = "East Asia",
}
countries = {
[k.Europe] = {"Albania", "Andorra", "Armenia", ...},
[k.Asia] = {
[k.Central_Asia] = {"Kazakhstan", "Kyrgyzstan", "Tajikistan", ...},
[k.East_Asia] = {"China", "Hong Kong", "Macau", ...},
...
},
...
}
Abbreviation for a required module
[modifica]When a variable or function (for example, named MyFunction1
) of a module (for example, named MyModule
) is used, it is used the require ()
function from another module. It would be like {{#invoke|MyModule|MyFunction1}}
from a template. The equivalent would be require ("Module: MyModule").MyFunction
. If this call is required many times this would not be practical, so an intermediate variable MM
is used as well.
local MM = require ("Module:MyModule")
...
MM.MyFunction1 ()
MM.MyFunction2 ()
...
In practical terms, abbreviations-variables are included at the beginning of the module.
"Wildcard" p.
[modifica]In order to be able to "export" variables and functions to another module, these variables or functions are preceded by p.
. If you define a p.error
variable that will contain the explanation of an error, and collected in the SimpleArgs
module, to know that it contains from another module and with the abbreviation SA
for the module, it can called with SA.error
to obtain its value.
Usable preset items
[modifica]In the Catalan Wikipedia some differentiating items are used (color of the title and icons):
Colors for titles and headers
[modifica]The following colors are referred to:
- Header: In the background color of the title and group headings. Corresponds to
rs_colorbox
. - Subheader: To labels that have a long content (therefore with collapsible text). Corresponds to
rs_color_tit_cllps
.
Header | RGB | Subheader | RGB |
---|---|---|---|
building | #c3e2ef | building | #e2ecf0 |
culture | Moccasin | culture | #f4ecdd |
event | #ccccff | event | #e3e3f6 |
living_being | gold | living_being | #eee8cb |
location | #d9b38c | location | #e3d9ce |
organization | LightSalmon | organization | #eed5cb |
person | #d6d6c2 | person | #e5e5d9 |
science | #b0d1ad | science | #d5e0d4 |
Other colors can be used, redefinable in the i18n, in:
p.preset_val = {
[GIBTi.rk.rs_colorbox] = "", -- ? Header
[GIBTi.rk.rs_color_tit_cllps] = "", -- ? Subheader
...
To obtain a specific color:
{{#invoke:Global infobox tools|GetInfoboxColor|organization|2}}
-> #eed5cb
Icons for titles
[modifica]The following icons are used in the Catalan Wikipedia for infoboxes, with correspondence to the template in English if it exists:
While others may be used.
To get a specific icon:
{{#invoke:Global infobox tools|GetIcon|person}}
-> Simpleicons Interface user-outline.svg
Examples
[modifica]- Only-lua: {{Infotaula malaltia}}
- Preinfobox: Module:Preinfobox person