Module:Wikidata/Units
La documentation pour ce module peut être créée à Module:Wikidata/Units/doc
local wikidata_units = {
Q11573 = {
label = 'metro',
ucode = 'm',
},
Q5151 = {
label = 'ayyur',
plural = 'ayyuren',
},
Q174728 = {
label = 'zentimetro',
plural = 'zentimetro',
ucode = 'cm',
},
Q828224 = {
label = 'akilumitr',
plural = 'ikilumitren',
ucode = 'km',
},
Q712226 = {
label = 'kilometro koadro',
plural = 'kilometro koadro',
ucode = 'km²',
},
Q25343 = {
label = 'metro koadro',
plural = 'metro koadro',
ucode = 'm²',
},
}
local function getUnit(amount, label, unitID, code)
local id_data = wikidata_units[unitID] or {}
local unit_text = ''
if code then
unit_text = id_data.ucode or id_data.label or label
elseif amount == "1" then
unit_text = id_data.label or label
else
unit_text = id_data.plural or label
end
return unit_text
end
return {getUnit = getUnit}