Skip to content

Instantly share code, notes, and snippets.

@klhall1987
Last active October 24, 2019 10:40
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save klhall1987/a25d93ebf71de6c7050f00a00f934cd0 to your computer and use it in GitHub Desktop.
Make Translatable strings with Ninja Forms Date Picker.
<?php
/*
Plugin Name: Date Picker test
*/
add_filter( 'ninja_forms_enqueue_scripts', 'nf_datepicker_options' );
function nf_datepicker_options()
{
wp_enqueue_script( 'nf_datepicker_options', plugin_dir_url( __FILE__ ) . 'script.js', array( 'jquery' ), false, true );
}
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 ) {
dateObject.pikaday._o.i18n = {
previousMonth : 'Previous Month',
nextMonth : 'Next Month',
months : ['January','February','March','April','May','June','July','August','September','October','November','December'],
weekdays : ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
weekdaysShort : ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
};
}
}));
});
@edianogama
Copy link

I put this where?

@christiandegeus
Copy link

Hi!

Indeed. This is the solution. But how to implement this?

Best, Chris

@hoinielsen
Copy link

hoinielsen commented Oct 24, 2019

I'm also interested in knowing how to implement this?? Can anyone tell me/us?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment