stellar-client
stellar-client copied to clipboard
Decimal and Thousands Separators
I have a friend who having more than 2,000 STR thought that she had only 2 STR. That's because in US commas are used to separate thousands. That is not valid in other locales and makes users confused. I think we can leverage navigator.language and display amounts in correct locale.
Previous discussion: https://github.com/stellar/stellar-client/issues/614#issuecomment-51828408
There are 2 features that need to be considered:
- Support digit grouping separators
- Support regional decimal separators
Separately they are easy. Together they create some ambiguity.
"123,456"could mean123456or123.456.Maybe something along the lines of
(123456.789).toLocaleString().match(/123(.?)456(.?)789/)to detect the locale encoding?http://stackoverflow.com/questions/4951738/culture-sensitive-parsefloat-function-in-javascript
Correlating navigator.language sounds scary (monster locale table).
Probing Number.prototype.toLocaleString() would ensure that we match the behavior of the user's browser.
One other thing that we could do is make the decimals be a lighter color to signify less significance

But then again, we already hide the non-important digits and STR shouldn't have any digits in this picture.