Language translation for date picker calendar on checkout page

Follow these steps to enable language translation for the date picker calendar on the checkout page:

1. Open your theme’s functions.php file

Navigate to your child theme’s directory and locate the functions.php file. If it doesn’t exist, create one.

2. Insert the following code snippet

Copy and paste the code snippet below into your functions.php file:

function alp_date_picker_translate_script(){
?>
<script>
jQuery(document).ready(function (jQuery) {
	jQuery.datepicker.regional['fr-FR'] = {
		clearText: 'Effacer', clearStatus: '',
		closeText: 'Fermer', closeStatus: 'Fermer sans modifier',
		prevText: '&lt;Préc', prevStatus: 'Voir le mois précédent',
		nextText: 'Suiv&gt;', nextStatus: 'Voir le mois suivant',
		currentText: 'Courant', currentStatus: 'Voir le mois courant',
		monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
		'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
		monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Juin',
		'Juillet','Août','Sept','Oct','Nov','Déc'],
		monthStatus: 'Voir un autre mois', yearStatus: 'Voir un autre année',
		weekHeader: 'Sm', weekStatus: '',
		dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
		dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
		dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
		dayStatus: 'Utiliser DD comme premier jour de la semaine', dateStatus: 'Choisir le DD, MM d',
		dateFormat: 'dd/mm/yy', firstDay: 0, 
		initStatus: 'Choisir la date', isRTL: false
	};
});
</script>
<?php
}
add_action('wp_head', 'alp_date_picker_translate_script');

3. Customize the language translation

Modify the code snippet within the alp_date_picker_translate_script function to suit your desired language. In the provided example, it’s set for French (‘fr-FR’). Adjust the translations as needed.

4. Save the file

Save the changes to your functions.php file.

By following these steps, you’ve successfully enabled language translation for the date picker calendar on the checkout page.

$129.00

Billed annually

Buy Now