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

How to support dynamic currencies #15

Open
brenwell opened this issue Feb 8, 2016 · 3 comments
Open

How to support dynamic currencies #15

brenwell opened this issue Feb 8, 2016 · 3 comments

Comments

@brenwell
Copy link

brenwell commented Feb 8, 2016

Hey there, I am back with a couple more stupid questions. But I have decided to split them as they are unrelated.

First, My project requires multiple currencies and languages. I cloned the JQuery/globalize/examples/app-npm-webpack/ project and changed the code in index.js to the following

var Globalize = require( "globalize" );
var codes = ["USD","EUR","CAD","AUD","GBP","SEK"]
var cc = codes[randomInt] // get a random currency
var currencyFormatter = Globalize.currencyFormatter(cc);
document.getElementById( "currency" ).textContent = currencyFormatter( 69900 );

And I get build fails with No Globalize compiled data module found. I assume you are parsing the project for the supported currency codes, but is there a way to list the needed currency codes aswell?

Thanks again.

@rxaviers
Copy link
Owner

You need a formatter for each currency, please see globalizejs/globalize-compiler#10 (comment)

If you want to contribute, it would be great if we could update docs to include that information.

Thanks and feel free to post additional comments if you have further questions.

@brenwell
Copy link
Author

Ok I understand. Thank you.

I have actually fallen back to using toLocaleString() for the moment as it is so easy to implement.

However I suspect I will be back to try again with Globalize, and when I do I will be happy to contribute. Thanks

@rxaviers
Copy link
Owner

Brainstorming potential solutions here globalizejs/globalize-compiler#10 (comment)

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

No branches or pull requests

2 participants