@@ -74,12 +74,19 @@ def query(self, query):
7474 subtitle = _ ("Check documentation for accepted units" ),
7575 )
7676 else :
77- c = do_convert ["converted" ]
78- p = smart_precision (locale .localeconv ()["decimal_point" ], c , 3 )
77+ converted = do_convert ["converted" ]
78+ category = do_convert ["category" ]
79+ to_long = do_convert ["toplural" ]
80+ to_abb = do_convert ["toabbrev" ]
81+ from_long = do_convert ["fromplural" ]
82+ from_abb = do_convert ["fromabbrev" ]
83+ converted_precision = smart_precision (
84+ locale .localeconv ()["decimal_point" ], converted , 3
85+ )
7986 self .add_item (
80- title = (do_convert [ " category" ] ),
87+ title = (category ),
8188 subtitle = (
82- f"{ locale .format_string ('%.10g' , float (args [0 ]), grouping = True )} { args [ 1 ] } = { locale .format_string (f'%.{ p } f' , c , grouping = True )} { args [ 2 ] } "
89+ f"{ locale .format_string ('%.10g' , float (args [0 ]), grouping = True )} { from_long } ( { from_abb } ) = { locale .format_string (f'%.{ converted_precision } f' , converted , grouping = True )} { to_long } ( { to_abb } ) "
8390 ),
8491 icon = f"assets/{ do_convert ['category' ]} .ico" ,
8592 )
@@ -94,7 +101,7 @@ def query(self, query):
94101 )
95102
96103
97- def get_all_units (short = False ):
104+ def get_all_units (short : bool = False ):
98105 """Returns all available units as a list of lists by category
99106
100107 :param short: if True only unit abbreviations are returned, default is False
0 commit comments