Open optroodt opened 10 years ago
I want to be able to format the currency according to a specific locale.
For example, my site is translated in Dutch, English, French and German and the correct rules for formatting an amount in e.g. Euro are:
Dutch (nl-NL): € 10,00 English (en-GB): €10.00 German (de-DE): 10,00 € French (fr-FR): 10,00 €
Of course you could define formats for every locale yourself, to me it makes sense that accounting.js does this for you given a locale.
There is a native function toLocaleString that does this and which might be helpful: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString
Babel's format_currency (Python) does the same.
Similar to https://github.com/josscrowcroft/accounting.js/issues/74
I want to be able to format the currency according to a specific locale.
For example, my site is translated in Dutch, English, French and German and the correct rules for formatting an amount in e.g. Euro are:
Dutch (nl-NL): € 10,00 English (en-GB): €10.00 German (de-DE): 10,00 € French (fr-FR): 10,00 €
Of course you could define formats for every locale yourself, to me it makes sense that accounting.js does this for you given a locale.
There is a native function toLocaleString that does this and which might be helpful: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString
Babel's format_currency (Python) does the same.