globalize-webpack-plugin
globalize-webpack-plugin copied to clipboard
How to support dynamic currencies
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.
You need a formatter for each currency, please see https://github.com/jquery-support/globalize-compiler/issues/10#issuecomment-173571256
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.
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
Brainstorming potential solutions here https://github.com/globalizejs/globalize-compiler/issues/10#issuecomment-406702647