If nothing else is like a trick solution (which does not pass the Turkish test, see the comment), you can use the output of toLocaleString() to determine the formatting information for numbers in the locale. For the current language, for example:
var decimalSeparator = (12345.6789).toLocaleString().match(/345(.*)67/)[1]; var thousandSeparator = (12345.6789).toLocaleString().match(/12(.*)345/)[1]; var numberOfDecimals = (12345.6789).toLocaleString().match(/345(\D*)(\d+)$/)[2].length;
The same trick can be used to format the currency using, for example, (12345.6789).toLocaleString("en-GB", { style: "currency" }) .
bzlm source share