@@ -74,12 +74,19 @@ def query(self, query):
74
74
subtitle = _ ("Check documentation for accepted units" ),
75
75
)
76
76
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
+ )
79
86
self .add_item (
80
- title = (do_convert [ " category" ] ),
87
+ title = (category ),
81
88
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 } ) "
83
90
),
84
91
icon = f"assets/{ do_convert ['category' ]} .ico" ,
85
92
)
@@ -94,7 +101,7 @@ def query(self, query):
94
101
)
95
102
96
103
97
- def get_all_units (short = False ):
104
+ def get_all_units (short : bool = False ):
98
105
"""Returns all available units as a list of lists by category
99
106
100
107
:param short: if True only unit abbreviations are returned, default is False
0 commit comments