/
Translate the datepicker

Thanks for using Woffice! If you have any issue or question, feel free to open a ticket at https://woffice.io/support/

Translate the datepicker

If ever you need to translate the Date picker component for your project, .po files will not work here. As it is all managed through a third-party JavaScript plugin. 

Hopefully, it's easily changeable. Add the following to your child theme's functions.php:

/**
 * Add the datepicker translation by overriding the English one
 */
function woffice_calendar_translation() {
	$data = '
		/*
         * Calendar translation
         */
        ;(function($){
            $.fn.datepicker.dates[\'en\'].days           = ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"];
            $.fn.datepicker.dates[\'en\'].months         = ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"];
            $.fn.datepicker.dates[\'en\'].daysShort      = ["dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."];
            $.fn.datepicker.dates[\'en\'].daysMin        = ["d", "l", "ma", "me", "j", "v", "s"];
            $.fn.datepicker.dates[\'en\'].monthsShort    = ["janv.", "févr.", "mars", "avril", "mai", "juin", "juil.", "août", "sept.", "oct.", "nov.", "déc."];
            $.fn.datepicker.dates[\'en\'].today          = "Aujourd\'hui";
            $.fn.datepicker.dates[\'en\'].monthsTitle    = "Mois";
            $.fn.datepicker.dates[\'en\'].clear          = "Effacer";
            $.fn.datepicker.dates[\'en\'].weekStart      = 1;
            $.fn.datepicker.dates[\'en\'].format         = "dd/mm/yyyy";
        }(jQuery));
	
	';

	wp_add_inline_script( 'woffice-projects-datepicker', $data);
}
add_action('wp_enqueue_scripts', 'woffice_calendar_translation', 100);


This is an example for the French version, you can find the existing translations from here: 

https://github.com/uxsolutions/bootstrap-datepicker/tree/master/js/locales

Keep the same format as the example above and copy/paste the values only from the built-in translations. As you can notice the format is different.


Related content

File Manager
Read with this
Languages
More like this
Projects
Read with this
Woffice - Elementor Birthday Widget
Woffice - Elementor Birthday Widget
More like this
Groups integration
Groups integration
Read with this
Dp Pro Event Calendar
Dp Pro Event Calendar
More like this

If you have any issue or question, feel free to open a ticket at https://woffice.io/support/