@@ -554,50 +554,59 @@ public static function render_select2_ajax() {
554554 // ensure localized strings are used
555555 $ javascript .= "
556556 function getEnhancedSelectFormatString() {
557+
558+ if ( 'undefined' !== typeof wc_select_params ) {
559+ wc_enhanced_select_params = wc_select_params;
560+ }
561+
562+ if ( 'undefined' === typeof wc_enhanced_select_params ) {
563+ return {};
564+ }
565+
557566 var formatString = {
558567 formatMatches: function( matches ) {
559568 if ( 1 === matches ) {
560- return wc_select_params .i18n_matches_1;
569+ return wc_enhanced_select_params .i18n_matches_1;
561570 }
562571
563- return wc_select_params .i18n_matches_n.replace( '%qty%', matches );
572+ return wc_enhanced_select_params .i18n_matches_n.replace( '%qty%', matches );
564573 },
565574 formatNoMatches: function() {
566- return wc_select_params .i18n_no_matches;
575+ return wc_enhanced_select_params .i18n_no_matches;
567576 },
568577 formatAjaxError: function( jqXHR, textStatus, errorThrown ) {
569- return wc_select_params .i18n_ajax_error;
578+ return wc_enhanced_select_params .i18n_ajax_error;
570579 },
571580 formatInputTooShort: function( input, min ) {
572581 var number = min - input.length;
573582
574583 if ( 1 === number ) {
575- return wc_select_params .i18n_input_too_short_1
584+ return wc_enhanced_select_params .i18n_input_too_short_1
576585 }
577586
578- return wc_select_params .i18n_input_too_short_n.replace( '%qty%', number );
587+ return wc_enhanced_select_params .i18n_input_too_short_n.replace( '%qty%', number );
579588 },
580589 formatInputTooLong: function( input, max ) {
581590 var number = input.length - max;
582591
583592 if ( 1 === number ) {
584- return wc_select_params .i18n_input_too_long_1
593+ return wc_enhanced_select_params .i18n_input_too_long_1
585594 }
586595
587- return wc_select_params .i18n_input_too_long_n.replace( '%qty%', number );
596+ return wc_enhanced_select_params .i18n_input_too_long_n.replace( '%qty%', number );
588597 },
589598 formatSelectionTooBig: function( limit ) {
590599 if ( 1 === limit ) {
591- return wc_select_params .i18n_selection_too_long_1;
600+ return wc_enhanced_select_params .i18n_selection_too_long_1;
592601 }
593602
594- return wc_select_params .i18n_selection_too_long_n.replace( '%qty%', number );
603+ return wc_enhanced_select_params .i18n_selection_too_long_n.replace( '%qty%', number );
595604 },
596605 formatLoadMore: function( pageNumber ) {
597- return wc_select_params .i18n_load_more;
606+ return wc_enhanced_select_params .i18n_load_more;
598607 },
599608 formatSearching: function() {
600- return wc_select_params .i18n_searching;
609+ return wc_enhanced_select_params .i18n_searching;
601610 }
602611 };
603612
0 commit comments