hi guys!
I need to translate the language of the datepicker, to spanish.
And also I need the calendar to start on monday instead of sunday.
Can you help me please?
hi guys!
I need to translate the language of the datepicker, to spanish.
And also I need the calendar to start on monday instead of sunday.
Can you help me please?
The jQuery UI datepicker can be localized:
http://docs.jquery.com/UI/Datepicker/Localization
Setting the region should also take care of starting the week on Monday, but you can also change the start day of the week: http://stackoverflow.com/q/1313317
Hi Chris, thanks for your answer, Im sorry Im a little bit rookie in this matters.
I've found the localization file: jquery.ui.datepicker-es.js
But I get lost in the instruccions in this part:
"....
It should then set these values as global defaults so that they are automatically applied when this JavaScript is loaded: $.datepicker.setDefaults($.datepicker.regional['<language>']);. ...."
wich gravity form file do I have to modify so it works?
Thanks.
Im assuming that the file jquery.ui.datepicker-es.js goes in this folder:
"../gravityforms/js/jquery-ui/"
Don't modify any Gravity Forms files.
I would put the language file in your child theme folder, in a js folder beneath that. Something like this:
/var/www/public_html/example.com/wp-content/themes/child-theme/js/jquery.ui.datepicker-es.js
Then, you need to include that in the footer of the page where the form is loaded.
Use the WordPress wp_enqueue_script function to make sure the script is loaded in the footer and after jQuery and the jQuery UI datepicker script is loaded.
That will load the translation file in the footer of your page. View the source of the page and find the script link, then try accessing the file by URL in your browser to make sure you have the path correct.
The additional JavaScript to make the language choice global will be added to the header (or footer, I think) section of the page. You can save this script to a file, and enqueue it in the same way:
jQuery(document).ready(function($) {
$.datepicker.setDefaults($.datepicker.regional['es']);
});
Let us know after you have tried that and link to the page with your datepicker on it if you need any additional assistance.
Thanks for your answer Chris, but 2 days after I post my last reply, I've managed to work it out in this way:
1 - I manually translate the days and months in this file: gravityforms/js/jquery-ui/ui.datepicker.js
2. I follow these instructions here:
http://stackoverflow.com/questions/1313317/set-start-day-of-the-week-in-jquery-ui-datepicker
In order to make "monday" the first day of the week, instead of sunday.
Thanks anyway!
Thank you for the update.