Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(409)

Unified Diff: pkg/intl/lib/src/intl/number_format.dart

Issue 556993003: Make it clearer how to specify currency symbols/alternate names (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 80 col Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/intl/lib/src/intl/number_format.dart
diff --git a/pkg/intl/lib/src/intl/number_format.dart b/pkg/intl/lib/src/intl/number_format.dart
index e44eddde854cbbeef1681300b3dd9403d25b6e72..272d70b2832fe83f816fe24d138a526d4047c4c2 100644
--- a/pkg/intl/lib/src/intl/number_format.dart
+++ b/pkg/intl/lib/src/intl/number_format.dart
@@ -30,12 +30,13 @@ part of intl;
* 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", "€");
* 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 @@ class NumberFormat {
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, "€");
+ */
+ 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698