def localize(formatted, grouping=False, monetary=False): if '.' in formatted: seps = 0 parts = formatted.split('.') if grouping: parts[0], seps = locale._group(parts[0], monetary=monetary) decimal_point = locale.localeconv()[ monetary and 'mon_decimal_point' or 'decimal_point'] formatted = decimal_point.join(parts) if seps: formatted = locale._strip_padding(formatted, seps) else: seps = 0 if grouping: formatted, seps = locale._group(formatted, monetary=monetary) if seps: formatted = locale._strip_padding(formatted, seps) return formatted
def update_event(self, inp=-1): self.set_output_val(0, locale._group(self.input(0), self.input(1)))