Support » Plugin: Ninja Forms Contact Form - The Drag and Drop Form Builder for WordPress » Ninja forms 3 date piker in german language?

  • Resolved swashwebdesign

    (@swashwebdesign)


    Is there a chance to change the ninja 3 date picker from english to german? At the moment the weeks start in sunday, in germany we need a start at monday. How could we change the language?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Hello swashwebdesign, you can customize language and week start day like this: enqueue a new js via your theme functions.php

    
    function my_nf_datepicker_localization(){
    	wp_enqueue_script( 'nf_datepicker_options', get_stylesheet_directory_uri() . '/js/datepicker-de_DE.js', array( 'jquery' ), false, true );
    }
    add_filter( 'ninja_forms_enqueue_scripts', 'my_nf_datepicker_localization' );

    And then drop datepicker-de_DE.js js file in /js folder of your theme

    jQuery( document ).ready( function() {
        new(Marionette.Object.extend( {
    
            initialize: function() {
                this.listenTo( Backbone.Radio.channel( 'pikaday' ), 'init', this.modifyDatepicker );
            },
            
            //Change the strings below to translate the string in our datepicker. 
            modifyDatepicker: function( dateObject, fieldModel ) {
            	console.log(dateObject);
            	console.log(fieldModel);
    		dateObject.pikaday._o.i18n = {
    			previousMonth : 'Vormonat',
    			nextMonth     : 'Nächster Monat',
    			months        : ['Januar', 'Februar',  'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
    			weekdays      : ['Sonntag', 'Montag','Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
            weekdaysShort : ['So.', 'Mo.', 'Di.', 'Mi.', 'Do.', 'Fr.', 'Sa.']
    		};
    		//no date selection in the past
    		dateObject.pikaday._o.minDate = moment().toDate();
    		//Monday is first week day
    		dateObject.pikaday._o.firstDay = 1;
            }
        }));
    });
    • This reply was modified 3 years, 4 months ago by Mad Max.

    He Daniele,
    thank you for your great job. It works perfect!!!!!!!

    Have a nice weekend!!!
    Best regards from germany
    Frank

    Thank you for answer!

    Hello,

    i’m using Ninja forms on a website for my client and i tried to apply this solution into the theme, but it doesn’t work.

    Is something maybe changed in the plugin meanwhile, that would cause this solution not to work?

    It would be great if you can help out regarding this.

    Thank you

    it should work in Ninja Forms > 3.x. Which NF version are you using?

    Aham ok, i have 2.9.58.

    Can i update the plugin to the newest version without losing any data?

    Ok, i have a problem with update-ing plugin to 3.xx version, since the theme is also using “Ninja Forms – Layout Master” plugin, which is not compatible with 3.xx version of NF yet.

    Can you please provide me with this same solution, but for 2.9.58 please?

    I would be very grateful.

    tripatwhat

    (@tripatwhat)

    Any chance of getting the same thing for 2.9.58?

    Mad Max

    (@mad_max)

    I’m sorry but I don’t have sites with NF 2.9x anymore. Hope someone can help.

    tripatwhat

    (@tripatwhat)

    Ok, no problem. We’ve managed to find a solution. Thx.

    danke! merci! thank you! gracias!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Ninja forms 3 date piker in german language?’ is closed to new replies.