Skip to content

Commit

Permalink
Country select
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Mar 17, 2017
1 parent 2011c19 commit c1ce490
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 37 deletions.
71 changes: 35 additions & 36 deletions assets/js/frontend/country-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,47 @@ jQuery( function( $ ) {
}

function getEnhancedSelectFormatString() {
var formatString = {
noResults: function() {
return wc_country_select_params.i18n_no_matches;
},
errorLoading: function() {
return wc_country_select_params.i18n_ajax_error;
},
inputTooShort: function( args ) {
var remainingChars = args.minimum - args.input.length;

if ( 1 === remainingChars ) {
return wc_country_select_params.i18n_input_too_short_1;
}
return {
'language': {
errorLoading: function() {
return wc_country_select_params.i18n_ajax_error;
},
inputTooLong: function( args ) {
var overChars = args.input.length - args.maximum;

if ( 1 === overChars ) {
return wc_country_select_params.i18n_input_too_long_1;
}

return wc_country_select_params.i18n_input_too_short_n.replace( '%qty%', remainingChars );
},
inputTooLong: function( args ) {
var overChars = args.input.length - args.maximum;
return wc_country_select_params.i18n_input_too_long_n.replace( '%qty%', overChars );
},
inputTooShort: function( args ) {
var remainingChars = args.minimum - args.input.length;

if ( 1 === overChars ) {
return wc_country_select_params.i18n_input_too_long_1;
}
if ( 1 === remainingChars ) {
return wc_country_select_params.i18n_input_too_short_1;
}

return wc_country_select_params.i18n_input_too_long_n.replace( '%qty%', overChars );
},
maximumSelected: function( args ) {
if ( 1 === args.maximum ) {
return wc_country_select_params.i18n_selection_too_long_1;
}
return wc_country_select_params.i18n_input_too_short_n.replace( '%qty%', remainingChars );
},
loadingMore: function() {
return wc_country_select_params.i18n_load_more;
},
maximumSelected: function( args ) {
if ( args.maximum === 1 ) {
return wc_country_select_params.i18n_selection_too_long_1;
}

return wc_country_select_params.i18n_selection_too_long_n.replace( '%qty%', args.maximum );
},
loadingMore: function() {
return wc_country_select_params.i18n_load_more;
},
searching: function() {
return wc_country_select_params.i18n_searching;
return wc_country_select_params.i18n_selection_too_long_n.replace( '%qty%', args.maximum );
},
noResults: function() {
return wc_country_select_params.i18n_no_matches;
},
searching: function() {
return wc_country_select_params.i18n_searching;
}
}
};

var language = { 'language' : formatString };
return language;
}

// Select2 Enhancement if it exists
Expand Down
2 changes: 1 addition & 1 deletion assets/js/frontend/country-select.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c1ce490

Please sign in to comment.