Mukääcëtök:Wikidata/Units
Appearance
Documentation for this module may be created at Mukääcëtök:Wikidata/Units/doc
-- syntax:
-- Qxxx = {
-- label = "label from Wikidata fixed",
-- plural = "label of unit for plural amount",
-- ucode = "code from Wikidata fixed",
-- },
local wikidata_units = {
--Q11573 = {
-- label = 'metre',
-- plural = 'metres',
-- ucode = 'm',
-- },
Q11229 = {
ucode = '%',
},
}
local function getUnit(amount, label, unitID, code)
if label == nil then return unitID end
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 id_data.label or label -- or require("Module:ca-flexió").plural(id_data.label or label)
end
return unit_text
end
return {getUnit = getUnit}