Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement currency formatting #351

Closed
wants to merge 28 commits into from
Closed

Implement currency formatting #351

wants to merge 28 commits into from

Conversation

rxaviers
Copy link
Member

  • Implementation
  • Tests
  • Doc

Fix #238

@ragulka ragulka mentioned this pull request Nov 28, 2014
1 task
@rxaviers
Copy link
Member Author

rxaviers commented Dec 1, 2014

Info about size...

globalize/currency is 2.6K minified and gzipped (96% the size of globalize/number), i.e., considerable size. Most of the bytes come from [:^S:] implementation, which is used to generate the formatter. But, not used to execute it.

This PR has minimal impact on other modules, adds 52 bytes on globalize (core), removes 32 bytes from globalize/date and removes 3 bytes from globalize/number.

@rxaviers
Copy link
Member Author

rxaviers commented Dec 2, 2014

This is ready for review.

@rxaviers rxaviers force-pushed the fix-238-currency branch 3 times, most recently from fdd4263 to e597b03 Compare December 2, 2014 14:27
rxaviers added a commit that referenced this pull request Dec 2, 2014
rxaviers added a commit that referenced this pull request Dec 2, 2014
rxaviers added a commit that referenced this pull request Dec 2, 2014
rxaviers added a commit that referenced this pull request Dec 2, 2014
The number of decimal places and the rounding for each currency is not
locale-specific. Those values are overridden by Supplemental Currency
Data.

Ref #238
Ref #351
rxaviers added a commit that referenced this pull request Dec 2, 2014
rxaviers added a commit that referenced this pull request Dec 2, 2014
- Add `.currencyFormatter( currency [, options] )`;
- Add `.formatCurrency( value, currency [, options] )`;

Ref #238
Ref #351
rxaviers added a commit that referenced this pull request Dec 2, 2014
The number of decimal places and the rounding for each currency is not
locale-specific. Those values are overridden by Supplemental Currency
Data.

Ref #238
Ref #351
- Add `.currencyFormatter( currency [, options] )`;
- Add `.formatCurrency( value, currency [, options] )`;

Ref #238
Ref #351
Amends "Plural: Create generator method".
Amends 3e1626e
Ref #335
Ref #336
locales using the plural messages `Globalize( locale ).currencyFormatter( currency,
{ style: "name" } )( 1 )`.

| `USD` | `1.00 US dollar` | `1,00 US-Dollar` | `1.00美元` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like its missing the header line, like the previous one:

| 3-letter currency code | en (English) | de (German) | zh (Chinese) |

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. Thanks, fixed.

"This looks like its missing the header line, like the previous one"
"This duplicates too much information from currency-formatter.md, should just
reference that"
@@ -0,0 +1,13 @@
define(function() {

// Generated by:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment explaining what this regex does would help.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

@rxaviers
Copy link
Member Author

rxaviers commented Dec 9, 2014

Updates made.

rxaviers added a commit that referenced this pull request Dec 10, 2014
rxaviers added a commit that referenced this pull request Dec 10, 2014
rxaviers added a commit that referenced this pull request Dec 10, 2014
The number of decimal places and the rounding for each currency is not
locale-specific. Those values are overridden by Supplemental Currency
Data.

Ref #238
Ref #351
rxaviers added a commit that referenced this pull request Dec 10, 2014
rxaviers added a commit that referenced this pull request Dec 10, 2014
rxaviers added a commit that referenced this pull request Dec 10, 2014
rxaviers added a commit that referenced this pull request Dec 10, 2014
- Add `.currencyFormatter( currency [, options] )`;
- Add `.formatCurrency( value, currency [, options] )`;

Fixes #238
Closes #351
rxaviers added a commit that referenced this pull request Dec 10, 2014
rxaviers added a commit that referenced this pull request Dec 10, 2014
The number of decimal places and the rounding for each currency is not
locale-specific. Those values are overridden by Supplemental Currency
Data.

Ref #238
Ref #351
rxaviers added a commit that referenced this pull request Dec 10, 2014
rxaviers added a commit that referenced this pull request Dec 10, 2014
rxaviers added a commit that referenced this pull request Dec 10, 2014
rxaviers added a commit that referenced this pull request Dec 10, 2014
- Add `.currencyFormatter( currency [, options] )`;
- Add `.formatCurrency( value, currency [, options] )`;

Fixes #238
Closes #351
rxaviers added a commit that referenced this pull request Dec 10, 2014
rxaviers added a commit that referenced this pull request Dec 10, 2014
@rxaviers rxaviers closed this in bb3f7b3 Dec 10, 2014
@rxaviers rxaviers deleted the fix-238-currency branch December 10, 2014 15:06
@jzaefferer jzaefferer mentioned this pull request Dec 23, 2014
3 tasks
rxaviers added a commit to rxaviers/globalize that referenced this pull request Feb 15, 2015
rxaviers added a commit that referenced this pull request Feb 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Formatting currencies
2 participants