Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Datepicker localization

I need a french calendar and I can't understand the problem. I guess I'm not using the regional options like it should be. But...

Here is my code :

$(function() {   $('#Date').datepicker({       showMonthAfterYear: false,       showOn: 'both',       buttonImage: 'media/img/calendar.png',       buttonImageOnly: true,       dateFormat:'d MM, y'     },     $.datepicker.regional['fr']   ); }); 
like image 798
Shipow Avatar asked Sep 21 '09 02:09

Shipow


1 Answers

That code should work, but you need to include the localization in your page (it isn't included by default). Try putting this in your <head> tag, somewhere after you include jQuery and jQueryUI:

<script type="text/javascript"         src="https://raw.githubusercontent.com/jquery/jquery-ui/master/ui/i18n/datepicker-fr.js"> </script> 

I can't find where this is documented on the jQueryUI site, but if you view the source of this demo you'll see that this is how they do it. Also, please note that including this JS file will set the datepicker defaults to French, so if you want only some datepickers to be in French, you'll have to set the default back to English.

You can find all languages here at github: https://github.com/jquery/jquery-ui/tree/master/ui/i18n

like image 154
Kip Avatar answered Oct 21 '22 06:10

Kip