Where Can In Find The Locale Objects For D3.js For Different Countries
this url (https://github.com/mbostock/d3/wiki/Localization) shows two examples for locales en_US: { 'decimal': '.', 'thousands': ',', 'grouping': [3], 'currenc
Solution 1:
D3 does not load any localization strings, it creates a new object that handles the localization via d3.locale
method. In the D3 source, there are some pre-made definitions; you can find them at:
- https://github.com/d3/d3-format/tree/master/locale
- https://github.com/d3/d3-time-format/tree/master/locale
When you want to use the format of another locale than en-US
, this is an example for you:
var esLocaleDef = {...}; // your definition, you can copy from es-Es.js file in the above folder.
var esLocale = d3.locale(esLocaleDef);
// use esLocale.numberFormat instead of d3.format
var esNumberFormat = esLocale.numberFormat(...);
// use esLocale.timeFormat instead of d3.time.format
var esTimeFormat = esLocale.timeFormat(...);
Post a Comment for "Where Can In Find The Locale Objects For D3.js For Different Countries"