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.

Date function in foreign language

  1. ilmedia
    Member

    Hi,

    I am using the date picker and accordingly a calender pops up with dates and weekdays. However, the site is non-english so I would like to "translate" the weekdays (SU, MO, TU etc).

    I tried to translate the GF files but as I understand the date function origins from some javascript so that did not work.

    How do I do this?

    Regards

    Dale

    Posted 12 years ago on Wednesday May 30, 2012 | Permalink
  2. David Peralty

    Have a look at the localization information related to this: http://jqueryui.com/demos/datepicker/

    Posted 12 years ago on Wednesday May 30, 2012 | Permalink
  3. ilmedia
    Member

    Hi,

    thanks for the link. Unfortunately I have no knowledge of jQeury and do not know where to start.

    The dates should be translated into the Swedish languge and I think I have found the right file here:
    http://jquery-ui.googlecode.com/svn/trunk/ui/i18n/jquery.ui.datepicker-sv.js

    Then I have found two files that seem to be of interest:
    ui.datepicker.js
    datepicker.js

    The instructions tell me the following:
    "The desired localization file should be included after the main datepicker code."

    And here I am completely lost. I suppose it is the code I have refered to above but where exaclty should I include it? I have no idea where the 'main datepicker code' is.

    Thus, all help appreciated.

    Thanks in advance

    Dale

    Posted 12 years ago on Wednesday May 30, 2012 | Permalink
  4. David Peralty

    Upload the script to your website and grab the path for it.

    Put the following in your functions.php file for your theme:
    http://www.gravityhelp.com/documentation/page/Gform_enqueue_scripts
    Making sure the JS file you point at is the jquery.ui.datepicker-sv.js

    This should make it so all your date pickers use the Swedish language file.

    If not, then look at this:
    http://www.gravityhelp.com/documentation/page/Where_Do_I_Put_This_Code%3F

    Put the following JS code in your head (or header.php) file:

    $.datepicker.setDefaults($.datepicker.regional["sv"]);
    Posted 12 years ago on Wednesday May 30, 2012 | Permalink
  5. ilmedia
    Member

    Hi again,

    I am sorry but I cannot make it work.

    I placed the file jquery.ui.datepicker-sv.js in mydomain.com/wp-content/plugins/gravityforms/js/

    Then I added the following code to functions.php

    add_action("gform_enqueue_scripts", "enqueue_custom_script", 10, 2);
    function enqueue_custom_script($form, $is_ajax){
        if($is_ajax){
            wp_enqueue_script("custom_script", "http://www.mydomain.com/wp-content/plugins/gravityforms/js/jquery.ui.datepicker-sv.js");
        }
    }

    No result.

    Then I added the second code to header.php file of the the Genesis framework from Studiopress.

    <?php
    /*
     WARNING: This file is part of the core Genesis framework. DO NOT edit
     this file under any circumstances. Please do all modifications
     in the form of a child theme.
     */
    
    /**
     * Handles the header structure.
     *
     * This file is a core Genesis file and should not be edited.
     *
     * @category Genesis
     * @package  Templates
     * @author   StudioPress
     * @license  http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)
     * @link     http://www.studiopress.com/themes/genesis
     */
    
    do_action( 'genesis_doctype' );
    do_action( 'genesis_title' );
    do_action( 'genesis_meta' );
    
    wp_head(); /** we need this for plugins **/
    ?>
    
    <script type="text/javascript">
        jQuery(document).ready(function($) {
    
            $.datepicker.setDefaults($.datepicker.regional["sv"]);
    
        });
    </script>
    
    </head>
    <body <?php body_class(); ?>>
    <?php
    do_action( 'genesis_before' );
    ?>
    <div id="wrap">
    <?php
    do_action( 'genesis_before_header' );
    do_action( 'genesis_header' );
    do_action( 'genesis_after_header' );
    
    echo '<div id="inner">';
    genesis_structural_wrap( 'inner' );

    But still the dates show up in the English language.

    As I have mentioned before - my knowledge of working with scripts is really limited and obviously I do something completely wrong here. So further help is appreciated.

    Regards

    Dale

    Posted 12 years ago on Thursday May 31, 2012 | Permalink
  6. David Peralty

    Can you link to your form for me?

    Posted 12 years ago on Thursday May 31, 2012 | Permalink
  7. ilmedia
    Member

    Hi again,

    the site is not public yet but I can send you the login credentials by PM or email. How do I send you a PM or what is your email?

    Regards

    Dale

    Posted 12 years ago on Thursday May 31, 2012 | Permalink
  8. David Peralty

    My e-mail is peralty@rocketgenius.com. Please link to this forum thread in your message. :)

    Posted 12 years ago on Thursday May 31, 2012 | Permalink
  9. Hi
    I'm having the exact same problem except I'm changing the date picker to 'es', I followed the instructions but the picker is stubbornly staying in English
    http://aprendeenirlanda.com/testform/

    Thanks Niall

    Posted 12 years ago on Monday July 9, 2012 | Permalink
  10. Looks like the date picker is in Spanish to me?

    http://minus.com/mKLHehiMk/

    Posted 12 years ago on Tuesday July 10, 2012 | Permalink