bisq-network / bisq

A decentralized bitcoin exchange network
https://bisq.network
GNU Affero General Public License v3.0
4.71k stars 1.27k forks source link

Use localised number formats for transaction details #3145

Open yoshimo opened 5 years ago

yoshimo commented 5 years ago

When an offer is confirmed by both sides and you get the bank account , identifier for the transaction and the rest of the necessary payment details, the amount of money to pay is written with a "." as separator. In some parts of the world we dont use a dot but a "," to tell dollars and cents, euro and cents etc apart. If you copy & paste one version into your online banking website you either get errors or you might paste a bit too much because of 1.000 could also mean one thousand and not just plain simply exactly one .

Would be nice if that part of bisq would be locale dependent too.

ghost commented 4 years ago

Can you please provide some example in which currency I can achieve this situation.

My experience is, that Bisq always (AFAIK) rounds payment to the whole number => no cents.

Do I miss something?

Thank you.

yoshimo commented 4 years ago

Yes the final sum is rounded for privacy reasons, still the exchange rate and the other fields , be it btc, the exchange rate or the range between the lowest amount and the highest you can buy do show fractions. So can the fee estimations " 0.00023423 BTC (~13.06 EUR) "8.50 bsq (~5.12 EUR) Depending on the btc-fiat exchange rate 8785.0000 could also be interpreted in the wrong way depending on your local habits.

yoshimo commented 4 years ago

grafik

cd2357 commented 4 years ago

This could be achieved by the user choosing a specific locale.

Example from https://www.baeldung.com/java-decimalformat :

assertThat(new DecimalFormat("#,###.##", 
      new DecimalFormatSymbols(Locale.ENGLISH)).format(d))
      .isEqualTo("1,234,567.89");

assertThat(new DecimalFormat("#,###.##", 
      new DecimalFormatSymbols(Locale.ITALIAN)).format(d))
      .isEqualTo("1.234.567,89");

The locale could then affect the rendering of all numbers, by choosing the correct decimal separator when rendering.

premek commented 3 years ago

Note: also see https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html#getDefault--

alvasw commented 2 years ago

Hey everyone! I'm working on this now. If anyone else claimed this already just let me know. Thanks!

alvasw commented 2 years ago

I'm busy working on Bisq 2. Feel free to base your solution on my pull request if it's helpful.