| 238 | // Localize jQuery UI datepicker. |
| 239 | if ( isset( $wp_locale ) ) { // Not set when loaded via load-scripts.php. |
| 240 | $datepicker_date_format = str_replace( |
| 241 | array( |
| 242 | 'd', 'j', 'l', 'z', // day |
| 243 | 'F', 'M', 'n', 'm', // month |
| 244 | 'Y', 'y' // year |
| 245 | ), |
| 246 | array( |
| 247 | 'dd', 'd', 'DD', 'o', |
| 248 | 'MM', 'M', 'm', 'mm', |
| 249 | 'yy', 'y' |
| 250 | ), |
| 251 | get_option( 'date_format' ) |
| 252 | ); |
| 253 | $datepicker_defaults = wp_json_encode( array( |
| 254 | 'closeText' => __( 'Close' ), |
| 255 | 'currentText' => __( 'Today' ), |
| 256 | 'monthNames' => array_values( $wp_locale->month ), |
| 257 | 'monthNamesShort' => array_values( $wp_locale->month_abbrev ), |
| 258 | 'monthStatus' => __( 'Show a different month' ), |
| 259 | 'nextText' => __( 'Next' ), |
| 260 | 'prevText' => __( 'Previous' ), |
| 261 | 'dayNames' => array_values( $wp_locale->weekday ), |
| 262 | 'dayNamesShort' => array_values( $wp_locale->weekday_abbrev ), |
| 263 | 'dayNamesMin' => array_values( $wp_locale->weekday_initial ), |
| 264 | 'dateFormat' => $datepicker_date_format, |
| 265 | 'firstDay' => absint( get_option( 'start_of_week' ) ), |
| 266 | 'isRTL' => $wp_locale->is_rtl(), |
| 267 | ) ); |
| 268 | $scripts->add_inline_script( 'jquery-ui-datepicker', "jQuery(document).ready(function(jQuery){jQuery.datepicker.setDefaults({$datepicker_defaults});});" ); |
| 269 | } |
| 270 | |