forked from globalizejs/globalize
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Currency: Implement currency formatting (name and code mode) (2/2)
Ref globalizejs#238 Ref globalizejs#351
- Loading branch information
Showing
4 changed files
with
68 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,22 @@ | ||
define([ | ||
"./supplemental-override", | ||
"./unit-patterns", | ||
"../number/pattern", | ||
"./code-properties", | ||
"../util/object/filter" | ||
], function( currencySupplementalOverride, currencyUnitPatterns, numberPattern, objectFilter ) { | ||
], function( currencyCodeProperties, objectFilter ) { | ||
|
||
/** | ||
* nameProperties( currency, cldr ) | ||
* | ||
* Return number pattern with the appropriate currency code in as literal. | ||
*/ | ||
return function( currency, cldr ) { | ||
var pattern = numberPattern( "decimal", cldr ); | ||
var properties = currencyCodeProperties( currency, cldr ); | ||
|
||
// The number of decimal places and the rounding for each currency is not locale-specific. Those | ||
// values overridden by Supplemental Currency Data. | ||
pattern = currencySupplementalOverride( currency, pattern, cldr ); | ||
properties.displayNames = objectFilter( cldr.main([ | ||
"numbers/currencies", | ||
currency | ||
]), /^displayName/ ); | ||
|
||
return { | ||
currency: currency, | ||
displayNames: objectFilter( cldr.main([ | ||
"numbers/currencies", | ||
currency | ||
]), /^displayName/ ), | ||
pattern: pattern, | ||
unitPatterns: currencyUnitPatterns( cldr ) | ||
}; | ||
return properties; | ||
}; | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters