Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why is my jquery UI datepicker not defaulting to english

i basically copied the code from here but when i tested my site i saw this:

alt text http://img148.imageshack.us/img148/8167/datepicker.png

any idea why i am not getting an english calendar

like image 383
leora Avatar asked Feb 11 '10 11:02

leora


1 Answers

From the jQuery UI docs, it's based on your computer's locale as c0mrade said in comments, but you can override:

Localization

Datepicker provides support for localizing its content to cater for different languages and date formats. Each localization is contained within its own file with the language code appended to the name, e.g. jquery.ui.datepicker-fr.js for French. These files are loaded after the main datepicker code. They add their settings to the set of available localizations and automatically apply them as defaults for all instances.

The $.datepicker.regional attribute holds an array of localizations, indexed by language code, with '' referring to the default (English). Each entry is an object with the following attributes: closeText, prevText, nextText, currentText, monthNames, monthNamesShort, dayNames, dayNamesShort, dayNamesMin, weekHeader, dateFormat, firstDay, isRTL, showMonthAfterYear, and yearSuffix.

You can restore the default localizations with:

$.datepicker.setDefaults($.datepicker.regional['']);

And can then override an individual datepicker for a specific locale:

$(selector).datepicker($.datepicker.regional['fr']);
like image 126
Nick Craver Avatar answered Nov 15 '22 22:11

Nick Craver