Dan Dan - 1 month ago 20
Javascript Question

Javascript Number and Currency localization

I've run into numbers and currency localization in JavaScript

What I need is a convenient library for that.

I am responsible for setting the decimal separators, currency, etc.

Please post the best links you think

Answer

The best answer for you probably depends on what javascript libary, if any, you are currently using. But YUI has support for number/currency formatting with internationalization, and it is a solid and well-designed library.

Example:

alert(Y.DataType.Number.format(123123123.176,{
    prefix: "€",
    thousandsSeparator: ".",
    decimalSeparator: ",",
    decimalPlaces: 2,
    suffix: " (EUR)"
}));