X-Git-Url: http://git.maemo.org/git/?p=gonvert;a=blobdiff_plain;f=src%2Funit_data.py;h=61770b5ee5dc275e92ad90c577e3ace8a917b67d;hp=9cc90a438d55f7557cee4cb07763fbff5521fab6;hb=1e2010632954ab734663bbc674b621b33c1d4374;hpb=475c4345b218a20433cb36f77aa058614c8433dd diff --git a/src/unit_data.py b/src/unit_data.py index 9cc90a4..61770b5 100644 --- a/src/unit_data.py +++ b/src/unit_data.py @@ -1,9 +1,14 @@ import math -import gettext import converters -_ = gettext.gettext +try: + raise ImportError() + import gettext +except ImportError: + _ = lambda x: x +else: + _ = gettext.gettext @@ -694,13 +699,13 @@ _(u"Electrical Voltage"): {".base_unit": _(u"volt"), _(u"litres per minute"): [(converters.m, 1.0/60), "lpm", ''], _(u"US gallons per minute"): - [(converters.m, 1/(60*3.785411784)), "gpm (US)", ''], + [(converters.m, 60*3.785411784), "gpm (US)", ''], _(u"US gallons per second"): - [(converters.m, 1/3.785411784), "gps (US)", ''], + [(converters.m, 3.785411784), "gps (US)", ''], _(u"UK gallons per minute"): - [(converters.m, 1/(60*4.54609028199)), "gpm (UK)", ''], + [(converters.m, 60*4.54609028199), "gpm (UK)", ''], _(u"UK gallons per second"): - [(converters.m, 1/4.54609028199), "gps (UK)", ''], + [(converters.m, 4.54609028199), "gps (UK)", ''], }, _(u"Force"): { @@ -1968,6 +1973,8 @@ _(u"Electrical Voltage"): {".base_unit": _(u"volt"), [(converters.m, 10*10*1.0), "dl", ''], _(u"mil"): [(converters.m, 1.0), '', _(u"Equal to one thousandth of a liter syn: milliliter, millilitre, ml, cubic centimeter, cubic centimeter, cc")], + _(u"fluid dram"): + [(converters.m, 2*3*4.92892159375/8), '', _(u"Used in Pharmaceutical")], _(u"minim"): [(converters.m, 2*3*4.92892159375/480), '', _(u"Used in Pharmaceutical to represent one drop. 1/60 fluid dram or 1/480 fluid ounce. A U.S. minim is about 0.003760 in\xb3 or 61.610 \xb5l. The British minim is about 0.003612 in\xb3 or 59.194 \xb5l. Origin of the word is from the Latin minimus, or small.")], }, @@ -2184,6 +2191,32 @@ _(u"Electrical Voltage"): {".base_unit": _(u"volt"), _(u"pony"): [(converters.m, 25.0), "", """Equal to twenty five pounds sterling"""], }, + + _(u"Radioactivity"): { + ".base_unit": "becquerel", + _(u"becquerel"): + [(converters.m, 1.0), u"Bq", 'The SI derived unit of radioactivity.'], + _(u"curie"): + [(converters.m, 3.7e10), u"Ci", 'Roughly the activity of 1 gram of the radium isotope 226 Ra.'], + _(u"pico curie"): + [(converters.m, 3.7e-2), u"pCi", ''], + }, + + _(u"Radiation dose"): { + ".base_unit": "Sievert", + _(u"Sievert"): + [(converters.m, 1.0), u"Sv", ''], + _(u"milli Sievert"): + [(converters.m, 1.0e-3), u"mSv", ''], + _(u"micro Sievert"): + [(converters.m, 1.0e-6), u"\xb5Sv", ''], + _(u"rem"): + [(converters.m, 0.01), u"rem", ''], + _(u"milli rem"): + [(converters.m, 1.0e-5), u"mrem", ''], + _(u"roentgen"): + [(converters.m, 1/1.07185e2), u"R", ''], + }, } @@ -2208,6 +2241,14 @@ def get_units_from_category(category): return units +def get_base_unit(categoryName): + return UNIT_DESCRIPTIONS[categoryName][".base_unit"] + + +def get_base_unit_from_category(category): + return category[".base_unit"] + + future_dic = { _(u"Wire Gauge"): { ".base_unit": "circular mils",