openexchangerates / accounting.js

A lightweight JavaScript library for number, money and currency formatting - fully localisable, zero dependencies.
http://openexchangerates.github.io/accounting.js
MIT License
4.96k stars 530 forks source link

Internationalisation and localisation #150

Open valtido opened 8 years ago

valtido commented 8 years ago

I think instead of providing settings as you do, under accounting.settings you should probably think about, accounting.locale = "en-GB" or accounting.locale = "en-US" etc etc... so we can slowly populate and represent for each country.

One thing you would have to bare in mind is that some countries allow more than one format or currency, so that should be taken into account.

All I'm saying is abstract the need to change the settings so generally as this is more error prone than that of a pre-defined settings/configs.

I really like this library other wise :)

eheath-hsc commented 7 years ago

Agree. A little wrapper interface around some locale based conventions would be a winner. Something like: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat with the currency option? Having your standalone lib support this would be great for cross browser compatibility.