Skip to content

DIS: restrict decimal sep to '.' for now, use locale-aware constants in the future

As discussed by the CIERMag group, it was suggested by Alberto and Edson to:

  • restrict the decimal separator to only . for now, instead of allowing . and ,.

This intends to keep the PyMR framework restricted to only one locale (USA) instead of generating ambiguity between Brazillian / European / American standards.

I think we can restrict it for now, since the spinbox is only being used by CIERMag, but we should implement a logic to be aware of the User locale and use this to define:

  • thousand separator
  • decimal separator

The unit separator should remain defined statically in the code or programatically through a function like set_unit_separator.

Implementing this locale logic will ensure that all use cases are satisfied in all countries, despite the American standard being the most used one.

Considerations

  • restricting the decimal separator to . will only require to edit one character in the validator regex
  • adding support for locale will require more work and refactoring of the validator / number interpretation logic (we currently have THOUSAND_SEPARATOR and UNIT_SEPARATOR constants defined but no DECIMAL_SEPARATOR constant)
Edited by Breno Pelegrin