[dart] r40072 committed - Make it clearer how to specify currency symbols/alternate names...

1 view
Skip to first unread message

da...@googlecode.com

unread,
Sep 9, 2014, 7:47:22 PM9/9/14
to com...@dartlang.org
Revision: 40072
Author: alank...@google.com
Date: Tue Sep 9 23:47:15 2014 UTC
Log: Make it clearer how to specify currency symbols/alternate names

BUG=
R=efor...@google.com

Review URL: https://codereview.chromium.org//556993003
https://code.google.com/p/dart/source/detail?r=40072

Modified:
/branches/bleeding_edge/dart/pkg/intl/lib/src/intl/number_format.dart

=======================================
--- /branches/bleeding_edge/dart/pkg/intl/lib/src/intl/number_format.dart
Wed Aug 27 19:10:50 2014 UTC
+++ /branches/bleeding_edge/dart/pkg/intl/lib/src/intl/number_format.dart
Tue Sep 9 23:47:15 2014 UTC
@@ -30,12 +30,13 @@
* one integer digit and three fraction digits.
*
* There are also standard patterns available via the special
constructors. e.g.
- * var symbols = new NumberFormat.percentFormat("ar");
+ * var percent = new NumberFormat.percentFormat("ar");
+ * var eurosInUSFormat = new
NumberFormat.currencyPattern("en_US", "EURO");
* There are four such constructors: decimalFormat, percentFormat,
* scientificFormat and currencyFormat. However, at the moment,
* scientificFormat prints only as equivalent to "#E0" and does not take
- * into account significant digits. currencyFormat will always use the name
- * of the currency rather than the symbol.
+ * into account significant digits. The currencyFormat will default to the
+ * three-letter name of the currency if no explicit name/symbol is
provided.
*/
class NumberFormat {
/** Variables to determine how number printing behaves. */
@@ -106,9 +107,14 @@
NumberFormat.scientificPattern([String locale]) :
this._forPattern(locale,
(x) => x.SCIENTIFIC_PATTERN);

- /** Create a number format that prints as CURRENCY_PATTERN. */
- NumberFormat.currencyPattern([String locale, String currency]) :
- this._forPattern(locale, (x) => x.CURRENCY_PATTERN, currency);
+ /**
+ * Create a number format that prints as CURRENCY_PATTERN. If provided,
+ * use [nameOrSymbol] in place of the default currency name. e.g.
+ * var eurosInCurrentLocale = new NumberFormat
+ * .currencyPattern(Intl.defaultLocale, "EURO");
+ */
+ NumberFormat.currencyPattern([String locale, String nameOrSymbol]) :
+ this._forPattern(locale, (x) => x.CURRENCY_PATTERN, nameOrSymbol);

/**
* Create a number format that prints in a pattern we get from
Reply all
Reply to author
Forward
0 new messages