Translating the Datepicker



This work-around is only necessary for Gravity Forms versions 2.4 and prior. The datepicker translations are part of the standard translation package in Gravity Forms 2.5.

The Datepicker used by the Date field is powered by the jQuery UI Datepicker script, which is bundled with WordPress; as such, it won’t be translated by the translation files included with Gravity Forms.

To translate the Datepicker, you will need to download the translation file for your desired language from the jQuery UI GitHub repository. Save the file to the /js/ directory of your active theme.

Next, you would add the following code snippet to your theme functions.php file, updating datepicker-your-lang with the actual name of the translation file you downloaded.

add_action( 'gform_enqueue_scripts', 'add_datepicker_regional', 11 );
function add_datepicker_regional() {
    if ( wp_script_is( 'gform_datepicker_init' ) ) {
        wp_enqueue_script( 'datepicker-regional', get_stylesheet_directory_uri() . '/js/datepicker-your-lang.js', array( 'gform_datepicker_init' ), false, true );
        remove_action( 'wp_enqueue_scripts', 'wp_localize_jquery_ui_datepicker', 1000 );
    }
}