Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make localization on months / days for D3js?
    primarykey
    data
    text
    <p>I am looking for a way to do localization on D3</p> <p>I have found the values</p> <pre><code>d3_time_days = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], d3_time_dayAbbreviations = [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], d3_time_months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], d3_time_monthAbbreviations = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ]; </code></pre> <p>inside <a href="https://raw.github.com/mbostock/d3/master/d3.js">D3</a> but as they are local/privat to D3 i (obviously) cant access them.</p> <p>Any hints would be great, thanks :)</p> <hr> <h3>Update 1:</h3> <p>Seems only a recompile can do the magic - but can't be boughtered - so ended up hard coding the edits in the minified version - shame on me...</p> <hr> <h3>Update 2:</h3> <p>Will try to look into how to make D3 accept an "on the fly" localization setting like fx <a href="http://momentjs.com">moment.js</a> does it:</p> <pre><code>moment.lang('da', { months : "Januar_Februar_Marts_April_Maj_Juni_Juli_August_September_Oktober_November_December".split("_"), monthsShort : "Jan_Feb_Mar_Apr_Maj_Jun_Jul_Aug_Sep_Okt_Nov_Dec".split("_"), weekdays : "Søndag_Mandag_Tirsdag_Onsdag_Torsdag_Fredag_Lørdag".split("_"), weekdaysShort : "Søn_Man_Tir_Ons_Tor_Fre_Lør".split("_"), weekdaysMin : "Sø_Ma_Ti_On_To_Fr_Lø".split("_"), ordinal : '%d.', week : { dow : 1, // Monday is the first day of the week. doy : 4 // The week that contains Jan 4th is the first week of the year. } }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload