Locale


Use locale option via JavaScript or data-locale via attribute to set the internationalization for the placeholder texts.

You update the placeholder texts the following way:

betterNiceSelect.LOCALISATION.en.formatSearch = function() {
    return "Search Vegetables, Fruits..."
}

 

Possible placeholder texts are:

  • formatSearch()
  • formatHelpForTagging()
  • formatAlertOptiongroups()
  • formatLoadingMessage()
  • formatCheckingMessage()

There exists multiple preexisting language output files. If you want english and a predefined language, select the right file to load into your browser before a BetterNiceSelect initialization.

There exists also a file with all predefined languages, which is called better-nice-select-locale-all.js which you can load into your browser!

<div class="container">
    <select multiple="multiple" data-toggle="better-nice-select" data-locale="ja-JP">
        <option value="Banana">Banana</option>
        <option value="Apple">Apple</option>
        <option value="Orange">Orange</option>
        <option value="Lemon" selected="selected">Lemon</option>
        <option value="Pepper">Pepper</option>
        <option value="Mushrooms">Mushrooms</option>
        <option value="Cabbages">Cabbages</option>
        <option value="Celery">Celery</option>
        <option value="Garlic">Garlic</option>
        <option value="Brocoli">Brocoli</option>
    </select>
</div>

let elements = document.querySelectorAll('[data-toggle="better-nice-select"]');
elements.forEach(element => new betterNiceSelect.BetterNiceSelect(element));