Implement configurable currency formatting.

This commit enables users of different countries around the world to configure currency formatting displayed to users in a familiar manner.

Prior to this commit US formatting (symbols) was forced upon users. This is now configurable via locale values e.g. en-US, de, fr-ch.

This commit adds two new configurations:
- currency-format
- currency-symbol-format-locale

One method ISettings#getCurrencyFormat()
This commit is contained in:
Ali Moghnieh 2016-06-19 20:03:54 +01:00
parent a267fb16b8
commit 282ec81af1
4 changed files with 75 additions and 0 deletions

View file

@ -15,6 +15,9 @@ import static com.earth2me.essentials.I18n.tl;
public class NumberUtil {
static DecimalFormat twoDPlaces = new DecimalFormat("#,###.##");
static DecimalFormat currencyFormat = new DecimalFormat("#0.00", DecimalFormatSymbols.getInstance(Locale.US));
// This field is likely to be modified in com.earth2me.essentials.Settings when loading currency format.
// This ensures that we can supply a constant formatting.
static final NumberFormat PRETTY_FORMAT = NumberFormat.getInstance(Locale.US);
static {