-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
data-count-selected-text - singular and plural #705
Comments
I agree. The best would be for something like gettext to exist for javascript and be common enough that using it wouldn't pull a new dependency. In the meantime I might add logic that permits |
yes that would be great. I could imagine something like this:
So basically the element should be exposed to the function - that way any random attribute can be accessed and processed. |
I was more thinking of having something like follow: $('select').selectpicker({
countSelectedText: function(num) {
if (num == 1) {
return "{0} item selected";
} else {
return "{0} items selected";
}
}
}); |
Each select could define its own function. I'm trying not to introduce an extra configuration variable if I don't have to. |
Well, I would need different texts for every select element. This would be the perfect and most versatile solution:
Everything stays as it is, except when a function is provided it is called with those 3 parameters. No extra configuration variable :-) |
What I wants is for the function to return a "format" string, not the formatted string (I want to do the replacement in the plugin code). You'd still be able to access the data since |
Ah, I see :) So it would look something like
|
Yes, that's what I have in mind. |
I would love to see this anytime soon as I really need it for my current project. In the meantime I will hack my copy of bootstrap-select.js around line 364. |
would be nice if one had the possibility to specify singular and plural texts.
for example:
data-count-selected-text="{0} items selected"
data-count-selected-text-singular="{0} item selected"
The text was updated successfully, but these errors were encountered: