Bootstrap-select: Change locale

Created on 12 Oct 2014  路  1Comment  路  Source: snapappointments/bootstrap-select

Seems like strings are hard coded into JS. So, on future, could there be way to override these strings this way:

$("#devicePicker").selectpicker({
    locale : {
        stringName    : "stringText"'
    }
});

or with data-attributes:

<select multiple="multiple" class="selectpicker" data-locale-stringname="stringText">
    <option> ... </option>
    <option> ... </option>
</select>

Thanks!

Most helpful comment

All the strings are localized (or should be). For instance, you can change the string displayed when no result match the live search using pure javascript (this only work if you disable the selectpicker data-api: $(document).off('.select.data-api')):

$('#devicePicker').selectpicker({
  noneResultsText: 'I found no results'
});

or using data-attributes:

<select class="selectpicker" id="devicePicker" data-none-results-text="I found no results">
  ...
</select>

>All comments

All the strings are localized (or should be). For instance, you can change the string displayed when no result match the live search using pure javascript (this only work if you disable the selectpicker data-api: $(document).off('.select.data-api')):

$('#devicePicker').selectpicker({
  noneResultsText: 'I found no results'
});

or using data-attributes:

<select class="selectpicker" id="devicePicker" data-none-results-text="I found no results">
  ...
</select>
Was this page helpful?
0 / 5 - 0 ratings