-- syntax:
--	Qxxx = { -- label from Wikidata, as a reference
--		label = "label fixed",
--		plural = "plural fixed",
--		ucode = "unit code to add or to fix",
--		},

local wikidata_units = {
    Q531 = { -- ano luze
		plural = "ani luze",
		},
	Q573 = { -- dì
		ucode = "dì",
		},
	Q4917 = { -- dòlari usa
		ucode = "$", -- reiteratiu
		},
	Q5151 = { -- meze
		plural = "mezi",
		},
	Q11229 = { -- persentuale
		plural = "persentuali",
		ucode = "%", -- reiteratiu
		},
	Q11573 = { -- metro
		ucode = "m", -- reiteratiu
		},
	Q25267 = { -- grado Celsius
		plural = "gradi Celsius",
		},
	Q3858002 = { -- milliampere-ora
		ucode = "mAh", 
		},
	Q42289 = { -- grado Fahrenheit
		plural = "gradi Fahrenheit",
		},
    Q55627 = { -- anys de vida ajustats per discapacitat
		plural = "ani de vita justà par dezabilità",
		ucode = "AVAD",
		},
	Q83327 = { -- eletro-volt
		plural = "eletroni-volt",
		},
	Q155009 = { -- Reichsmark
		ucode = "ℛℳ",
		},
	Q206037 = { -- revolucions per minut
		label = "revolusion",
		ucode = "RPM", -- WD: rev/min
		},
    Q209426 = { -- minut d'arc
		label = "minuto",
		},
	Q483261 = { -- unitat de massa atòmica
		ucode = "uma", -- WD: u
		},
	Q524410 = { -- mil milions d'anys
		plural = "mil milioni de ani",
		},
	Q550207 = { -- dòlar Geary-Khamis
		plural = "dòlari Geary-Khamis",
		ucode = "$",
		},
	Q712226 = { -- quilòmetre quadrat
		ucode = "km²", -- reiteratiu
		},
	Q743895 = { -- pulsacions per minut
		plural = "bàtiti par minuto",
		ucode = "ppm",
		},
	Q829073 = { -- segon d'arc
		label = "secondo",
		ucode = "″", -- WD amb cometes rectes
		},
	Q1463969 = { -- watt per metre-kelvin
		ucode = "W/(m·K)", -- WD: W m⁻¹ K⁻¹
		},
	Q2080811 = { -- fracció volumètrica
		label = "persentuale in volume",
		plural = "persentuale in volume",
		ucode = "%", -- WD: vol%
		},
	Q3085309 = { -- joule per quilogram-kelvin
		ucode = "J/Kg·K", -- WD: J kg⁻¹ K⁻¹
		},
	Q6859652 = { -- mil·límetre de mercuri
		ucode = "mm Hg", -- WD: mmHg
		},
	Q20966435 = { -- amper per volt-metre
		plural = "amper par volt-metro",
		},
	Q20966455 = { -- joule per mol-kelvin
		ucode = "J/mol·K", -- WD: J K⁻¹ mol⁻¹
		},
	Q21127659 = { -- gram per 100 grams de dissolvent
		ucode = "g/100 g desolvente",
		},
	Q23977060 = { -- decibel relatiu a 1 picaWatt
		ucode = "dB re 1pW", 
		},
	Q24564698 = { -- anys (d'edat)
		plural = "ani",
		},
	Q28739766 = { -- coulomb-metre
		ucode = "C·m", -- WD: C m
		},
	}

local function getUnit(amount, label, unitID, code, symbol)
	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 symbol or id_data.label or label
	elseif amount == "1" then
		unit_text = id_data.label or label or unitID
	else
		unit_text = id_data.plural or require("Module:vec-flesion").plural(id_data.label or label)
	end
	return unit_text
end

local convert_default = {
	Q218593 = "Q174789", -- in > mm
	Q3710 = "Q174728", -- ft > cm
	Q482798 = "Q11573", -- yd > m
	Q253276 = "Q828224", -- mi > km
	Q232291 = "Q712226", -- mi² > km²
	Q128822 = "Q180154", -- nus > km/h
}

return {
	getUnit = getUnit,
	convert_default = convert_default
}
Traesto fora da Wikipèdia - L'ençiclopedia łìbara e cołaboradiva in łéngua Vèneta "https://vec.wikipedia.org/w/index.php?title=Modulo:Wikidades/Units&oldid=1091944"