wolph / alfred-converter

Alfred unit converter is a smart calculator for Alfred with support for unit conversions to make it a bit comparable to the Google Calculator and Wolfram Alpha.
93 stars 15 forks source link

metric/imperial conversions #19

Closed klokie closed 4 years ago

klokie commented 4 years ago

hi, great work! It would be really useful to be able to convert between the following metric & imperial units:

Is this something you can point me toward how to add? thanks!

wolph commented 4 years ago

The problem with the imperial units is that even within the imperial system there are variations.

The gallon for example exists as both galUK and galUS image

The only ones in this list that are completely unsupported right now are the cups/tablespoons/teaspoons. I guess those were not important to the people that made the units file: http://w3.energistics.org/uom/poscUnits22.xml

Custom units can be added here but require a tiny bit of work: https://github.com/WoLpH/alfred-converter/blob/master/converter/extra_units.py

I'll see if I can get the spoons and cups as extra units of volume.

wolph commented 4 years ago

The cups are a bit of an issue: https://en.wikibooks.org/wiki/Cookbook:Cup

Metric cup: 250 mL US cup: 237, 240 or 250 mL Japanese cup: 180 mL Indian teacup: 190 mL

I've opted for a simple conversion to tablespoons (tablespoon is 15mL, 16*15=240mL) And the teaspoon is 5 mL so the tablespoon is exactly 3 teaspoons

klokie commented 4 years ago

Outstanding! Thanks!