How do I localize the jQuery UI Datepicker?
For those that still have problems, you have to download the language file your want from here:
and then include it in your page like this for example(italian language):
<script type="text/javascript" src="/scripts/jquery.ui.datepicker-it.js"></script>
then use zilverdistel's code :D
I figured out the demo and implemented it the following way:
$.datepicker.setDefaults( $.extend( {'dateFormat':'dd-mm-yy'}, $.datepicker.regional['nl'] ));
I needed to set the default for the dateformat too ...
The string $.datepicker.regional['it']
not translate all words.
For translate the datepicker you must specify some variables:
$.datepicker.regional['it'] = { closeText: 'Chiudi', // set a close button text currentText: 'Oggi', // set today text monthNames: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno', 'Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'], // set month names monthNamesShort: ['Gen','Feb','Mar','Apr','Mag','Giu','Lug','Ago','Set','Ott','Nov','Dic'], // set short month names dayNames: ['Domenica','Lunedì','Martedì','Mercoledì','Giovedì','Venerdì','Sabato'], // set days names dayNamesShort: ['Dom','Lun','Mar','Mer','Gio','Ven','Sab'], // set short day names dayNamesMin: ['Do','Lu','Ma','Me','Gio','Ve','Sa'], // set more short days names dateFormat: 'dd/mm/yy' // set format date};$.datepicker.setDefaults($.datepicker.regional['it']);$(".datepicker").datepicker();
In this case your datepicker is properly translated.