PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Translate Calendar

  1. cristianltorres
    Member

    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?

    Posted 11 years ago on Thursday December 13, 2012 | Permalink
  2. 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

    Posted 11 years ago on Friday December 14, 2012 | Permalink
  3. cristianltorres
    Member

    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.

    Posted 11 years ago on Friday December 14, 2012 | Permalink
  4. cristianltorres
    Member

    Im assuming that the file jquery.ui.datepicker-es.js goes in this folder:

    "../gravityforms/js/jquery-ui/"

    Posted 11 years ago on Friday December 14, 2012 | Permalink
  5. 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.

    Posted 11 years ago on Saturday December 22, 2012 | Permalink
  6. cristianltorres
    Member

    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!

    Posted 11 years ago on Tuesday January 8, 2013 | Permalink
  7. Thank you for the update.

    Posted 11 years ago on Tuesday January 8, 2013 | Permalink

This topic has been resolved and has been closed to new replies.