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

Official country setting #74

Open danielsedlacek opened 10 years ago

danielsedlacek commented 10 years ago

This is amazing library that saved me countless hours of work, the only missing part is to find the right settings for given countries.

How about we add to this project official settings per country?

thany commented 10 years ago

I was just thinking this. This is a good idea :)

Not neccesarily currencies for each country (which may prove to be very tricky), but more importantly how numbers are formatted. Some countries prefer the currency symbol after the value (like Finland, iirc), others put it before the number.

Secondly, there's the decimal separator and decimal grouping symbol. Some use a comma, others use a dot, and yet others use a space or even an apostrophe. Yes, it happens.

And a little bit more odd, some countries (notably Japan) use ten-thousand-separators, rather than thousand-separators, because of the way their number system is designed (10,000 is one "entitiy", and 100,000,000 is the next "entity" - so they would write it as 1.0000 and 1.0000.0000 respectively).

I propose we add this as an optional thing for this library. Perhaps a json "database" that can be plugged in, or left out.

thany commented 10 years ago

Oh and it is helpful to keep in mind that some currencies are indivisible, such as the Japanese Yen, South-Korean Won, Iraqi Dinar, etc.

noetix commented 9 years ago

+1

basepack commented 9 years ago

+1