Skip to content

Messages and translation ​

All visible and screen reader texts are in the messages option. {query}, {count} and {label} are replaced.

js
new FlowSelect('#city', {
  searchPlaceholder: 'Suchen...',
  messages: {
    noResultsFor: 'Keine Treffer für „{query}“',
    create: '„{query}“ anlegen'
  }
});

Only the messages you pass are replaced; the others keep their defaults.

All messages ​

KeyDefault
noResultsNo results
noResultsForNo results for “{query}”
loadingLoading...
searchingSearching...
errorCould not load results.
retryTry again
createCreate “{query}”
typeMoreType at least {count} characters
maxItemsYou can choose up to {count}
results{count} results (announced to screen readers)
oneResult1 result (announced to screen readers)
clearClear selection (label of the clear button)
removeRemove {label} (label of a chip's remove button)

The search box placeholder is the separate searchPlaceholder option, and the empty-control text is placeholder or your <option value="">.

Translate every select at once ​

js
FlowSelect.defaults.searchPlaceholder = 'Rechercher...';
FlowSelect.defaults.messages = {
  ...FlowSelect.defaults.messages,
  noResults: 'Aucun résultat',
  noResultsFor: 'Aucun résultat pour « {query} »',
  create: 'Créer « {query} »'
};

Set defaults before the selects start: put this script right after the flow-select script tag, with data-manual on the flow-select tag and FlowSelect.autoInit() after your defaults.

Right to left ​

Inside dir="rtl", the control and the list mirror automatically and the list aligns to the control's right edge.

Released under the MIT License.