Skip to content

Commit

Permalink
fix(a11y): italian messages by default for select autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
astagi committed Sep 17, 2024
1 parent 44a6c36 commit 3674652
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/js/plugins/select-autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,25 @@ class SelectAutocomplete extends BaseComponent {
this._hasFormControl = element.classList.contains('form-control')
this.element_original_id = this._element.id
this._config = config
if (!this._config.tAssistiveHint)
this._config.tAssistiveHint = () =>
'Quando i risultati del completamento automatico sono disponibili, usa le frecce su e giù per rivedere e Invio per selezionare. Utenti di dispositivi touch, esplora tramite tocco o con gesti di scorrimento'
if (!this._config.tNoResults) this._config.tNoResults = () => 'Nessun risultato trovato'
if (!this._config.tStatusQueryTooShort)
this._config.tStatusQueryTooShort = (minQueryLength) => `Digita ${minQueryLength} o più caratteri per mostrare le opzioni di ricerca`
if (!this._config.tStatusNoResults) this._config.tStatusNoResults = () => 'Nessun risultato di ricerca'
if (!this._config.tStatusSelectedOption)
this._config.tStatusSelectedOption = (selectedOption, length, index) => `${selectedOption} ${index + 1} di ${length} è sottolineato`
if (!this._config.tStatusResults)
this._config.tStatusResults = (length, contentSelectedOption) => {
const words = {
result: length === 1 ? 'risultato' : 'risultati',
is: length === 1 ? 'è' : 'sono',
available: length === 1 ? 'disponibile' : 'disponibili',
}

return `${length} ${words.result} ${words.is} ${words.available}. ${contentSelectedOption}`
}
this._enhance()
}

Expand Down

0 comments on commit 3674652

Please sign in to comment.