| 847 | } |
| 848 | |
| 849 | /** |
| 850 | * Localizes the jQuery UI datepicker. |
| 851 | * |
| 852 | * @since 4.6.0 |
| 853 | * |
| 854 | * @link http://api.jqueryui.com/datepicker/#options |
| 855 | * @global WP_Locale $wp_locale The WordPress date and time locale object. |
| 856 | * |
| 857 | * @param WP_Scripts $scripts WP_Scripts object. |
| 858 | */ |
| 859 | function wp_localize_jquery_ui_datepicker( $scripts ) { |
| 860 | global $wp_locale; |
| 861 | |
| 862 | // Convert the PHP date format into jQuery UI's format. |
| 863 | $datepicker_date_format = str_replace( |
| 864 | array( |
| 865 | 'd', 'j', 'l', 'z', // day |
| 866 | 'F', 'M', 'n', 'm', // month |
| 867 | 'Y', 'y' // year |
| 868 | ), |
| 869 | array( |
| 870 | 'dd', 'd', 'DD', 'o', |
| 871 | 'MM', 'M', 'm', 'mm', |
| 872 | 'yy', 'y' |
| 873 | ), |
| 874 | get_option( 'date_format' ) |
| 875 | ); |
| 876 | |
| 877 | $datepicker_defaults = wp_json_encode( array( |
| 878 | 'closeText' => __( 'Close' ), |
| 879 | 'currentText' => __( 'Today' ), |
| 880 | 'monthNames' => array_values( $wp_locale->month ), |
| 881 | 'monthNamesShort' => array_values( $wp_locale->month_abbrev ), |
| 882 | 'nextText' => __( 'Next' ), |
| 883 | 'prevText' => __( 'Previous' ), |
| 884 | 'dayNames' => array_values( $wp_locale->weekday ), |
| 885 | 'dayNamesShort' => array_values( $wp_locale->weekday_abbrev ), |
| 886 | 'dayNamesMin' => array_values( $wp_locale->weekday_initial ), |
| 887 | 'dateFormat' => $datepicker_date_format, |
| 888 | 'firstDay' => absint( get_option( 'start_of_week' ) ), |
| 889 | 'isRTL' => $wp_locale->is_rtl(), |
| 890 | ) ); |