jQuery Datepicker Language

The QCF plugin uses a jQuery datepicker for the date field. The default language is English. WordPress should localize the datepicker but sometimes gets it wrong. If your dates aren’t showing in your language there are a couple of ways round the problem.

Adding a Localisation Script

Go to: Dashboard > Appearance > Editor

From the list on the right of your page find footer.php

Just before the </body> tag, enter the following:
<script type="text/javascript" src="http://jquery-ui.googlecode.com/svn/trunk/ui/i18n/jquery.ui.datepicker-de.js"></script>
The above code is for German. You will need to change the ‘de’ to your language code.

Or use this tool to get the code.

Tweaking the Datepicker

This is a bit more complex but if you have a jquery call in your theme you can add the line:

$.datepicker.setDefaults( $.datepicker.regional[ "fr" ] );

The above code is for French. You will need to change the ‘fr’ to your language code.

For more information on localizing the datepicker this is a good source:

http://api.jqueryui.com/datepicker/

I plan to add a localization option to the plugin at some point which makes all the above redundant.

Add your comment

  1. karthik on 24 Dec 2016

    i need put on shortcode on auto responder mail box but you’re gave only three options for name and option and also date how i can put more shortcode on my more form filed name here

    • Graham on 24 Dec 2016

      What other shortcode do you need? Adding them is easy (it’s only one line of code) so I can get this back to you today.

  2. dhananjay on 19 Jan 2016

    I need Islamic and Gregion date picker in single calender. Can it is possible in jquery?

    • Graham on 19 Jan 2016

      It looks like you can do this. I use the built-in WordPress datepicker but there is no reason why you couldn’t enqueue a different calendar. Everything you need to know is here: http://keith-wood.name/calendars.html

  3. Janani on 15 Jul 2015

    Where can i find the list of language codes?

    • Graham on 15 Jul 2015

      Hi Janani,
      If you are using the Contact Form it should already be localized. If you are using the event manager it’s not an easy fix. Everything you need to know about the datepicker localizations is here: https://api.jqueryui.com/datepicker/

  4. Tom on 31 Jul 2014

    $.datepicker.setDefaults( $.datepicker.regional[ “fr” ] );
    In which file on wich place should this filled in?
    Please give an example, thanks!

    • Graham on 31 Jul 2014

      This method only works if you have a jQuery file somewhere in your theme. If you do then just add the code to the file so you have something like:
      jQuery(document).ready(function ($) {
      $.datepicker.setDefaults( $.datepicker.regional[ "fr" ] );
      });

      You could create the code in a new theme file but you then need to enqueue the script. It’s much simpler to add the localization script to your footer.php

  5. Tom on 31 Jul 2014

    doesn’t work 🙁

Web Analytics