|
22 | 22 | // Picker object |
23 | 23 |
|
24 | 24 | var Datepicker = function(element, options){ |
25 | | - this.id = DPGlobal.dpgId++; |
| 25 | + this.id = dpgId++; |
26 | 26 | this.element = $(element); |
27 | 27 | this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||'mm/dd/yyyy'); |
| 28 | + this.language = options.language in dates ? options.language : 'en' |
28 | 29 | this.picker = $(DPGlobal.template).appendTo('body'); |
29 | 30 | this.isInput = this.element.is('input'); |
30 | 31 | this.component = this.element.is('.date') ? this.element.find('.add-on') : false; |
|
141 | 142 | var dowCnt = this.weekStart; |
142 | 143 | var html = '<tr>'; |
143 | 144 | while (dowCnt < this.weekStart + 7) { |
144 | | - html += '<th class="dow">'+DPGlobal.dates.daysMin[(dowCnt++)%7]+'</th>'; |
| 145 | + html += '<th class="dow">' + dates[this.language].daysMin[(dowCnt++) % 7] + '</th>'; |
145 | 146 | } |
146 | 147 | html += '</tr>'; |
147 | 148 | this.picker.find('.datepicker-days thead').append(html); |
|
151 | 152 | var html = ''; |
152 | 153 | var i = 0 |
153 | 154 | while (i < 12) { |
154 | | - html += '<span class="month">'+DPGlobal.dates.monthsShort[i++]+'</span>'; |
| 155 | + html += '<span class="month">' + dates[this.language].monthsShort[i++] + '</span>'; |
155 | 156 | } |
156 | 157 | this.picker.find('.datepicker-months td').append(html); |
157 | 158 | }, |
|
162 | 163 | month = d.getMonth(), |
163 | 164 | currentDate = this.date.valueOf(); |
164 | 165 | this.picker.find('.datepicker-days th:eq(1)') |
165 | | - .text(DPGlobal.dates.months[month]+' '+year); |
| 166 | + .text(dates[this.language].months[month] + ' ' + year); |
166 | 167 | var prevMonth = new Date(year, month-1, 28,0,0,0,0), |
167 | 168 | day = DPGlobal.getDaysInMonth(prevMonth.getFullYear(), prevMonth.getMonth()); |
168 | 169 | prevMonth.setDate(day); |
|
376 | 377 | $.fn.datepicker.defaults = { |
377 | 378 | }; |
378 | 379 | $.fn.datepicker.Constructor = Datepicker; |
| 380 | + var dpgId = 0; |
| 381 | + var dates = $.fn.datepicker.dates = { |
| 382 | + en: { |
| 383 | + days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], |
| 384 | + daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], |
| 385 | + daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"], |
| 386 | + months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], |
| 387 | + monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] |
| 388 | + } |
| 389 | + }; |
379 | 390 |
|
380 | 391 | var DPGlobal = { |
381 | 392 | modes: [ |
|
394 | 405 | navFnc: 'FullYear', |
395 | 406 | navStep: 10 |
396 | 407 | }], |
397 | | - dates:{ |
398 | | - days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], |
399 | | - daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], |
400 | | - daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"], |
401 | | - months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], |
402 | | - monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] |
403 | | - }, |
404 | 408 | isLeapYear: function (year) { |
405 | 409 | return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)) |
406 | 410 | }, |
|
490 | 494 | '</table>'+ |
491 | 495 | '</div>'+ |
492 | 496 | '</div>'; |
493 | | - DPGlobal.dpgId = 0; |
494 | 497 |
|
495 | 498 | }( window.jQuery ) |
0 commit comments