edcarroll / ng2-semantic-ui

Semantic UI Angular Integrations (no jQuery)
https://edcarroll.github.io/ng2-semantic-ui/
MIT License
615 stars 223 forks source link

Add property to multi-select to customize text when haslabels is false #422

Closed guillepb closed 5 years ago

guillepb commented 6 years ago

This is a request more than an issue. Maybe there is a way to do it but I can't seem to find it in the documentation. Right now, when haslabels is false in a multi-select, the user selection is shown as "0 selections", "1 selection", etc. Would it be possible to add a property to customize the text so it can be anything other than "selections"?. In my case, it's needed for localization in Spanish.

Thank you!

janpapenbrock commented 5 years ago

Yes it is possible and generally documented here - but the option you requested is missing from the documentation, but is present in the code.

Localization for select is defined as follows, and you are probably looking for select.multi.selectedMessage:

    select: {
        noResultsMessage: "No results",
        single: {
            placeholder: "Select one"
        },
        multi: {
            placeholder: "Select...",
            maxSelectedMessage: "Max #{max} selections",
            selectedMessage: "#{count} selections"
        }
    }

Also, there is a default Spanish translation, did you see that already? https://github.com/edcarroll/ng2-semantic-ui/blob/master/src/behaviors/localization/locales/es.ts

guillepb commented 5 years ago

Thank you! (and also, sorry!, I totally missed the localization part of the documentation)