Skip to content

Commit 2bcb8da

Browse files
committed
Copied i18n code from Andrew Rowls fork
1 parent 2da7b49 commit 2bcb8da

33 files changed

+465
-12
lines changed

src/js/bootstrap-datepicker.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@
2222
// Picker object
2323

2424
var Datepicker = function(element, options){
25-
this.id = DPGlobal.dpgId++;
25+
this.id = dpgId++;
2626
this.element = $(element);
2727
this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||'mm/dd/yyyy');
28+
this.language = options.language in dates ? options.language : 'en'
2829
this.picker = $(DPGlobal.template).appendTo('body');
2930
this.isInput = this.element.is('input');
3031
this.component = this.element.is('.date') ? this.element.find('.add-on') : false;
@@ -141,7 +142,7 @@
141142
var dowCnt = this.weekStart;
142143
var html = '<tr>';
143144
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>';
145146
}
146147
html += '</tr>';
147148
this.picker.find('.datepicker-days thead').append(html);
@@ -151,7 +152,7 @@
151152
var html = '';
152153
var i = 0
153154
while (i < 12) {
154-
html += '<span class="month">'+DPGlobal.dates.monthsShort[i++]+'</span>';
155+
html += '<span class="month">' + dates[this.language].monthsShort[i++] + '</span>';
155156
}
156157
this.picker.find('.datepicker-months td').append(html);
157158
},
@@ -162,7 +163,7 @@
162163
month = d.getMonth(),
163164
currentDate = this.date.valueOf();
164165
this.picker.find('.datepicker-days th:eq(1)')
165-
.text(DPGlobal.dates.months[month]+' '+year);
166+
.text(dates[this.language].months[month] + ' ' + year);
166167
var prevMonth = new Date(year, month-1, 28,0,0,0,0),
167168
day = DPGlobal.getDaysInMonth(prevMonth.getFullYear(), prevMonth.getMonth());
168169
prevMonth.setDate(day);
@@ -376,6 +377,16 @@
376377
$.fn.datepicker.defaults = {
377378
};
378379
$.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+
};
379390

380391
var DPGlobal = {
381392
modes: [
@@ -394,13 +405,6 @@
394405
navFnc: 'FullYear',
395406
navStep: 10
396407
}],
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-
},
404408
isLeapYear: function (year) {
405409
return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0))
406410
},
@@ -490,6 +494,5 @@
490494
'</table>'+
491495
'</div>'+
492496
'</div>';
493-
DPGlobal.dpgId = 0;
494497

495498
}( window.jQuery )
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Bulgarian translation for bootstrap-datepicker
3+
* Apostol Apostolov <[email protected]>
4+
*/
5+
;(function($){
6+
$.fn.datepicker.dates['bg'] = {
7+
days: ["Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък", "Събота", "Неделя"],
8+
daysShort: ["Нед", "Пон", "Вто", "Сря", "Чет", "Пет", "Съб", "Нед"],
9+
daysMin: ["Н", "П", "В", "С", "Ч", "П", "С", "Н"],
10+
months: ["Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември"],
11+
monthsShort: ["Ян", "Фев", "Мар", "Апр", "Май", "Юни", "Юли", "Авг", "Сеп", "Окт", "Ное", "Дек"],
12+
today: "днес"
13+
};
14+
}(jQuery));
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Czech translation for bootstrap-datepicker
3+
* Matěj Koubík <[email protected]>
4+
*/
5+
;(function($){
6+
$.fn.datepicker.dates['cs'] = {
7+
days: ["Neděle", "Pondělí", "Úterý", "Středa", "Čtvrtek", "Pátek", "Sobota", "Neděle"],
8+
daysShort: ["Ne", "Po", "Út", "St", "Čt", "Pá", "So", "Ne"],
9+
daysMin: ["N", "P", "Ú", "St", "Č", "P", "So", "N"],
10+
months: ["Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec"],
11+
monthsShort: ["Led", "Úno", "Bře", "Dub", "Kvě", "Čer", "Čnc", "Srp", "Zář", "Říj", "Lis", "Pro"],
12+
today: "Dnes"
13+
};
14+
}(jQuery));
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Danish translation for bootstrap-datepicker
3+
* Christian Pedersen <http://github.com/chripede>
4+
*/
5+
;(function($){
6+
$.fn.datepicker.dates['da'] = {
7+
days: ["Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag", "Søndag"],
8+
daysShort: ["Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør", "Søn"],
9+
daysMin: ["Sø", "Ma", "Ti", "On", "To", "Fr", "Lø", "Sø"],
10+
months: ["Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November", "December"],
11+
monthsShort: ["Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"],
12+
today: "I Dag"
13+
};
14+
}(jQuery));
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* German translation for bootstrap-datepicker
3+
* Sam Zurcher <[email protected]>
4+
*/
5+
;(function($){
6+
$.fn.datepicker.dates['de'] = {
7+
days: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"],
8+
daysShort: ["Son", "Mon", "Die", "Mit", "Don", "Fre", "Sam", "Son"],
9+
daysMin: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"],
10+
months: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"],
11+
monthsShort: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"],
12+
today: "Heute"
13+
};
14+
}(jQuery));
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Spanish translation for bootstrap-datepicker
3+
* Bruno Bonamin <[email protected]>
4+
*/
5+
;(function($){
6+
$.fn.datepicker.dates['es'] = {
7+
days: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado", "Domingo"],
8+
daysShort: ["Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb", "Dom"],
9+
daysMin: ["Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa", "Do"],
10+
months: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"],
11+
monthsShort: ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"],
12+
today: "Hoy"
13+
};
14+
}(jQuery));
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Finnish translation for bootstrap-datepicker
3+
* Jaakko Salonen <https://github.com/jsalonen>
4+
*/
5+
;(function($){
6+
$.fn.datepicker.dates['fi'] = {
7+
days: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai", "sunnuntai"],
8+
daysShort: ["sun", "maa", "tii", "kes", "tor", "per", "lau", "sun"],
9+
daysMin: ["su", "ma", "ti", "ke", "to", "pe", "la", "su"],
10+
months: ["tammikuu", "helmikuu", "maaliskuu", "huhtikuu", "toukokuu", "kesäkuu", "heinäkuu", "elokuu", "syyskuu", "lokakuu", "marraskuu", "joulukuu"],
11+
monthsShort: ["tam", "hel", "maa", "huh", "tou", "kes", "hei", "elo", "syy", "lok", "mar", "jou"],
12+
today: "tänään"
13+
};
14+
}(jQuery));
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* French translation for bootstrap-datepicker
3+
* Nico Mollet <[email protected]>
4+
*/
5+
;(function($){
6+
$.fn.datepicker.dates['fr'] = {
7+
days: ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche"],
8+
daysShort: ["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam", "Dim"],
9+
daysMin: ["D", "L", "Ma", "Me", "J", "V", "S", "D"],
10+
months: ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"],
11+
monthsShort: ["Jan", "Fev", "Mar", "Avr", "Mai", "Jui", "Jul", "Aou", "Sep", "Oct", "Nov", "Dec"],
12+
today: "Aujourd'hui"
13+
};
14+
}(jQuery));
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* Croatian localisation
3+
*/
4+
;(function($){
5+
$.fn.datepicker.dates['hr'] = {
6+
days: ["Nedjelja", "Ponedjelja", "Utorak", "Srijeda", "Četrtak", "Petak", "Subota", "Nedjelja"],
7+
daysShort: ["Ned", "Pon", "Uto", "Srr", "Čet", "Pet", "Sub", "Ned"],
8+
daysMin: ["Ne", "Po", "Ut", "Sr", "Če", "Pe", "Su", "Ne"],
9+
months: ["Siječanj", "Veljača", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac"],
10+
monthsShort: ["Sije", "Velj", "Ožu", "Tra", "Svi", "Lip", "Jul", "Kol", "Ruj", "Lis", "Stu", "Pro"],
11+
today: "Danas"
12+
};
13+
}(jQuery));
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* Bahasa translation for bootstrap-datepicker
3+
* Azwar Akbar <[email protected]>
4+
*/
5+
;(function($){
6+
$.fn.datepicker.dates['id'] = {
7+
days: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu", "Minggu"],
8+
daysShort: ["Mgu", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab", "Mgu"],
9+
daysMin: ["Mg", "Sn", "Sl", "Ra", "Ka", "Ju", "Sa", "Mg"],
10+
months: ["Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"],
11+
monthsShort: ["Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Ags", "Sep", "Okt", "Nov", "Des"]
12+
};
13+
}(jQuery));

0 commit comments

Comments
 (0)