Tutorial :JQuery datepicker: how to translate? (won't accept dayNamesShort)



Question:

I am trying to translate JQuery's datepicker without much success. With the code below, months get correctly translated, while the days (short) are not translated! What's wrong?

<script type="text/javascript">    $(function() {      ...      $("#datepicker").datepicker({        onChangeMonthYear: function(year, month, inst) {...},        beforeShowDay: function(date) {...},        onSelect: function(dateText, inst) {...},          dayNamesShort: ['D', 'L', 'M', 'M', 'G', 'V', 'S'],        dayNames: ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'],        monthNames: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'],        monthNamesShort: ['Gen','Feb','Mar','Apr','Mag','Giu','Lug','Ago','Set','Ott','Nov','Dic'],        firstDay: 1      });    }    );  </script>  


Solution:1

From the source code:

dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting  dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday  

You alse need to translate dayNamesMin.


Solution:2

$("#datepicker").datepicker({              dayNames: ["one", "two", "three", "four", "five", "six", "seven"],              dayNamesShort: ["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"],              dayNamesMin: ["Sunday", "Monday", "Tuesday", "Wednesday",                             "Sandeep", "Friday", "Saturday"],              dateFormat: "y-MM-D", //To show dayNamesShort Values              dateFormat: "y-MM-DD", //To show dayNames Values});  

Note : Select any one at a time from dayNames and dayNamesShort.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »