Module:Wikidades/Units
Appearance
Documentation for this module may be created at Module:Wikidades/Units/doc
local wikidata_units = {
Q11573 = {
label = 'meadar',
ucode = 'm',
},
Q5151 = {
label = 'mee',
plural = 'meeghyn',
},
Q174728 = {
label = 'kentimeadar',
plural = 'kentimeadaryn',
ucode = 'cm',
},
Q828224 = {
label = 'kilomeadar',
plural = 'kilomeadaryn',
ucode = 'km',
},
Q253276 = {
label = 'meeiley',
plural = 'meeilaghyn',
ucode = 'mi',
},
Q93318 = {
label = 'mooir-veeiley',
plural = 'mooir-veeilaghyn',
ucode = 'nm',
},
Q128822 = {
label = 'mooir-veiley ’syn oor',
plural = 'mooir-veeilaghyn ’syn oor',
ucode = 'kn',
},
Q3710 = {
label = 'trie',
plural = 'trieghyn',
ucode = 'tr',
},
Q25343 = {
label = 'meadar kernit',
plural = 'meadaryn kernit',
ucode = 'm²',
},
Q712226 = {
label = 'kilomeadar kernit',
plural = 'kilomeadaryn kernit',
ucode = 'km²',
},
Q232291 = {
label = 'meeiley chernit',
plural = 'meeilaghyn kernit',
ucode = 'mi²',
},
Q35852 = {
label = 'hectimeadar',
plural = 'hectimeadaryn',
ucode = 'hm',
},
Q5195628 = {
label = 'hectimeadar kioobagh',
plural = 'hectimeadaryn kioobagh',
ucode = 'hm<sup>3</sup>',
},
Q2029519 = {
label = 'hectileetyr',
plural = 'hectileetyryn',
ucode = 'hL',
},
Q160857 = {
label = 'eagh-chummaght',
plural = 'each-chummaghtyn',
ucode = 'HP',
},
Q3320608 = {
label = 'kilowatt',
plural = 'kilowattyn',
ucode = 'kw',
},
Q11570 = {
label = 'kilogram',
plural = 'kilogramyn',
ucode = 'kg',
},
Q100995 = {
label = 'punt',
plural = 'puint',
ucode = 'lb',
},
Q11229 = {
label = 'mooad ’sy cheead',
plural = 'mooadyn ’sy cheead',
ucode = '%',
},
Q4917 = {
label = 'dollar ny Steatyn Unnaneysit',
plural = 'dollaryn ny Steatyn Unnaneysit',
ucode = '$',
},
Q25224 = {
label = 'punt Sostynagh',
plural = 'puint Hostynagh',
ucode = '£',
},
Q4916 = {
label = 'euro',
plural = 'euro',
ucode = '€',
},
Q1811 = {
label = 'unnid rollageydagh',
plural = 'unnidyn rollageydagh',
ucode = 'AU',
},
Q28390 = {
label = 'keim',
plural = 'keimyn',
ucode = '°',
},
Q573 = {
label = 'laa',
plural = 'laaghyn',
ucode = 'laaghyn',
},
Q25517 = {
label = 'meadar kioobagh',
plural = 'meadaryn kioobagh',
ucode = 'm<sup>3</sup>',
},
Q794261 = {
label = 'meadar kioobagh ’sy tootçhey',
plural = 'meadaryn kioobagh ’sy tootçhey',
ucode = 'm<sup>3</sup>/s',
},
Q7727 = {
label = 'minnid',
plural = 'minnidyn',
ucode = 'min',
},
Q11574 = {
label = 'tootçhey',
plural = 'tootçhaghyn',
ucode = 's',
},
Q41803 = {
label = 'gram',
plural = 'gramyn',
ucode = 'g',
},
Q218593 = {
label = 'oarlagh',
plural = 'oarleeyn',
ucode = '″',
},
Q1063786 = {
label = 'oarlagh kernit',
plural = 'oarleeyn kernit',
},
Q3710 = {
label = 'trie',
plural = 'trieghyn',
},
Q209426 = {
label = 'minnid',
plural = 'minnidyn',
ucode = '′',
},
Q829073 = {
label = 'tootçhey',
plural = 'tootçhaghyn',
ucode = '″',
},
Q11229 = {
label = 'mooad ’sy cheead',
plural = 'mooadyn ’sy cheead',
ucode = '%',
},
Q25267 = {
label = 'keim Chelshyssagh',
plural = 'keimyn Chelshyssagh',
ucode = '°C',
},
Q13147228 = {
label = 'gram ’sy chentimeadar kioobagh',
plural = 'gramyn ’sy chentimeadar kioobagh',
ucode = 'g/cm<sup>3</sup>',
},
Q2719498 = {
label = 'arqueig brut',
ucode = 'GT',
},
Q1781855 = {
label = 'arqueig net',
ucode = 'NT',
},
Q550207 = {
label = 'dollar Geary-Khamis',
plural = 'dollaryn Geary-Khamis',
ucode = '$',
},
Q79738 = {
label = 'gigabyte',
plural = 'gigabyteyn',
ucode = 'GB',
},
Q483261 = {
label = 'unnid dy ghlout breneenagh',
plural = 'unnidyn dy ghlout breneenagh',
ucode = 'uma',
},
Q42289 = {
label = 'keim Fahrenheit',
plural = 'keimyn Fahrenheit',
ucode = '°F',
},
Q6859652 = {
label = 'millimeadar dy vercur',
plural = 'millimeadaryn dy vercur',
ucode = 'mm Hg',
},
Q21077820 = {
label = 'milligram ’sy veadar kioobagh',
plural = 'milligramyn ’sy veadar kioobagh',
ucode = 'mg/m<sup>3</sup>',
},
Q752197 = {
label = 'kilojoule ’sy vol',
plural = 'kilojouleyn ’sy vol',
ucode = 'KJ/mol',
},
Q83327 = {
label = 'lectro-volt',
plural = 'lectro-voltyn',
ucode = 'eV',
},
Q191118 = {
label = 'thunney',
plural = 'thunnaghyn',
ucode = 't',
},
Q182429 = {
label = 'meadar ’sy tootçhey',
plural = 'meadaryn ’sy tootçhey',
ucode = 'm/s',
},
Q177974 = {
label = 'aeraght',
plural = 'aeraghtyn',
ucode = 'atm',
},
Q2080811 = {
label = 'mooad ’sy thummid',
plural = 'mooadyn ’sy thummid',
ucode = '%',
},
Q21127659 = {
label = 'gram per 100 grams de dissolvent',
plural = 'grams per 100 grams de dissolvent',
ucode = 'g/100 g dissolvent',
},
Q20966455 = {
label = 'joule ’sy vol-kelvin',
plural = 'joules ’sy vol-kelvin',
ucode = 'J/mol·K',
},
Q3085309 = {
label = 'joule ’sy chilogram-kelvin',
plural = 'jouleyn ’sy chilogram-kelvin',
ucode = 'J/Kg·K',
},
Q21061369 = {
label = 'gram ’sy chilogram',
plural = 'gramyn ’sy chilogram',
ucode = 'g/Kg',
},
Q174789 = {
label = 'millimeadar',
plural = 'millimeadaryn',
ucode = 'mm',
},
Q25235 = {
label = 'oor',
plural = 'ooryn',
ucode = 'h',
},
Q21091747 = {
label = 'milligram ’sy chilogram',
plural = 'milligramyn ’sy chilogram',
ucode = 'mg/Kg',
},
Q21006887 = {
label = 'ayrn ’sy villioon',
plural = 'ayrnyn ’sy villioon',
ucode = 'ppm',
},
Q26162545 = {
label = 'centímetre quadrat per segon',
plural = 'centímetres quadrats per segon',
ucode = 'cm<sup>2</sup>/s',
},
Q21604951 = {
label = 'gram ’sy veadar kioobagh',
plural = 'gramyn ’sy veadar kioobagh',
ucode = 'g/m<sup>3</sup>',
},
Q26156132 = {
label = 'millinewton ’sy veadar',
plural = 'millinewtonyn ’sy veadar',
ucode = 'mN/m',
},
Q21064807 = {
label = 'kilopascal',
plural = 'kilopascalyn',
ucode = 'kPa',
},
Q751310 = {
label = 'poiseuille',
plural = 'poiseuilles',
ucode = 'PI',
},
Q44395 = {
label = 'pascal',
plural = 'pascalyn',
ucode = 'Pa',
},
Q1463969 = {
label = 'watt per metre-kelvin',
plural = 'watts per metre-kelvin',
ucode = 'W/(m·K)',
},
Q40603 = {
label = 'debye',
plural = 'debyes',
ucode = 'D',
},
Q20966435 = {
label = 'ampere ’sy volt-meadar',
plural = 'ampereyn ’sy volt-meadar',
ucode = 'A/Vm',
},
Q319604 = {
label = 'passatger',
plural = 'passatgers',
},
Q155009 = {
label = 'Reichsmark',
ucode = 'ℛℳ',
},
Q1332978 = {
label = 'tonatge de pes mort',
ucode = 'DWT',
},
Q6998519 = {
label = 'arqueig de registre net',
ucode = 'NRT',
},
Q752079 = {
label = 'arqueig de registre brut',
ucode = 'GRT',
},
Q1394540 = {
label = "Builder's Old Measurement",
ucode = 'BOM',
},
Q26158194 = {
label = "mil·lipascal-segon",
ucode = 'mPa·s',
},
Q28739766 = {
label = "coulomb-metre",
ucode = 'C·m',
},
Q743895 = {
label = "builley ’sy vinnid",
plural = 'buillaghyn ’sy vinnid',
ucode = 'ppm',
},
Q531 = {
label = "any llum",
plural = 'anys llum',
ucode = 'a.l.',
},
Q4220561 = {
label = "kilomeadar ’sy tootçhey",
plural = 'kilomeadaryn ’sy tootçhey',
ucode = 'Km/s',
},
Q11579 = {
label = "Kelvin",
plural = 'Kelvinyn',
ucode = 'K',
},
Q55627 = {
label = "anys de vida ajustats per discapacitat",
plural = 'anys de vida ajustats per discapacitat',
ucode = 'AVAD',
},
Q79735 = {
label = 'megabyte',
ucode = 'MB',
},
Q3858002 = {
label = "milliampere",
ucode = 'mAh',
},
}
local function getUnit(amount, label, unitID, code)
if label == nil or label == '' 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
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
}