Add decimalDigits support to NumberFormat.compactSimpleCurrency().
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182853180
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d9d78ba..0d99963 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,7 @@
to provide a custom pattern if you have one, e.g. for accounting formats.
* Update data to CLDR 32.0.1
* Update for Dart 2.0 fixed-size integers.
+ * Add missing support for specifying decimalDigits in compactSimpleCurrency.
## 0.15.2
* Group the padding digits to the left of the number, if present. e.g. 00,001.
diff --git a/lib/src/intl/number_format.dart b/lib/src/intl/number_format.dart
index 51a04fd..ffcad51 100644
--- a/lib/src/intl/number_format.dart
+++ b/lib/src/intl/number_format.dart
@@ -526,7 +526,8 @@
/// of "$1,200,000", and which will automatically determine a currency symbol
/// based on the currency name or the locale. See
/// [NumberFormat.simpleCurrency].
- factory NumberFormat.compactSimpleCurrency({String locale, String name}) {
+ factory NumberFormat.compactSimpleCurrency(
+ {String locale, String name, int decimalDigits}) {
return new _CompactNumberFormat(
locale: locale,
formatType: _CompactFormatType.COMPACT_DECIMAL_SHORT_CURRENCY_PATTERN,
@@ -534,6 +535,7 @@
getPattern: (symbols) => symbols.CURRENCY_PATTERN,
computeCurrencySymbol: (format) =>
_simpleCurrencySymbols[format.currencyName] ?? format.currencyName,
+ decimalDigits: decimalDigits,
isForCurrency: true);
}
@@ -643,7 +645,7 @@
/// Used to test if we have exceeded integer limits.
// TODO(alanknight): Do we have a MaxInt constant we could use instead?
static final _maxInt = 1 is double ? pow(2, 52) : 1.0e300.floor();
- static final _maxDigits = (log(_maxInt)/log(10)).ceil();
+ static final _maxDigits = (log(_maxInt) / log(10)).ceil();
/// Helpers to check numbers that don't conform to the [num] interface,
/// e.g. Int64