Tagged: datepicker, jquery UI, regional
- This topic has 9 replies, 2 voices, and was last updated 6 years, 1 month ago by
Steve.
-
AuthorPosts
-
-
December 29, 2015 at 6:41 am #5436
vayuMemberHi, how do I change the language of the datepicker. I tried to do it via the options and via javascript, but none seem to work.
-
December 29, 2015 at 9:55 pm #5450
SteveKeymaster@vayu– Piklist uses the jQuery UI datepicker which is built into WordPress.
You need to pass your translated variables through the options parameter. Here’s an example in French:
piklist('field', array( 'type' => 'datepicker' ,'field' => 'my-date-field' ,'label' => 'Date' ,'options' => array( 'closeText'=>'Fermer', 'prevText'=>'Précédent', 'nextText'=>'Suivant', 'currentText'=>'Aujourd\'hui', 'monthNames'=>['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'], 'monthNamesShort'=>['Janv.','Févr.','Mars','Avril','Mai','Juin','Juil.','Août','Sept.','Oct.','Nov.','Déc.'], 'dayNames'=>['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'], 'dayNamesShort'=>['Dim.','Lun.','Mar.','Mer.','Jeu.','Ven.','Sam.'], 'dayNamesMin'=>['D','L','M','M','J','V','S'], 'weekHeader'=>'Sem.', 'dateFormat'=>'dd/mm/yy', 'firstDay'=>1, 'isRTL'=>false, 'showMonthAfterYear'=>false, 'yearSuffix'=>'' ) ));You may also be able to load one of these translation files, though I haven’t tried it.
-
December 30, 2015 at 9:56 am #5453
vayuMemberThis is great, thanks! Do you have any advice on how to find information about all such extra options/attributes for the different fields, because I could not find this in the docs?
-
December 30, 2015 at 10:23 am #5454
-
December 30, 2015 at 10:26 am #5456
vayuMemberThanks, I did google it as well and tried several things, but actually I meant for Piklist options, not specifically for datepicker. There is no information about being able to use these options in the Piklist docs.
-
December 30, 2015 at 10:35 am #5458
-
December 30, 2015 at 10:42 am #5459
vayuMemberOkay thanks. Maybe I just don’t really understand the options parameter. Is this only for jQuery options?
-
December 30, 2015 at 10:48 am #5460
SteveKeymasterIn most cases, with the exception of validation and sanitization, the
optionsarray is not determined by Piklist, but by the underlying library. jQuery UI fields… the WordPress media uploader… etc.But we do this with our documentation everywhere (and probably should explain it better). For instance, when registering a Post Type using Piklist, we only document the unique Piklist parameters, but you can also use every WordPress parameter in register_post_type as well.
-
December 30, 2015 at 10:50 am #5461
vayuMemberThank you for explaining this for me. 🙂
-
December 30, 2015 at 10:54 am #5462
SteveKeymasterThank you for letting us know we need to explain it better 😉
-
-
AuthorPosts
- The topic ‘datepicker regional’ is closed to new replies.