I have a list of schools whose names are both English and French (these are schools in Canada, where we have two official languages):
- Avondale Public School
- École secondaire Jean-Léger
- Samspon Street High School
- École de la Vache Sacrée
- (etc.)
I'd like to be able to type "ecole", not "école" into the Chosen widget, and have all the entries that start with "école" show up in my listing. Right now, if I type "ecole", Chosen tells me that "No results match 'ecole'." Due to sloppy inputting skills (and especially due to the many english-speakers who don't even know how to get the French accented characters on their keyboard), many people are going to be confused by this.
Basically, I want to be able to type "e", and have Chosen know that I mean any of "e", "è", "é", "ê", or "ë". (And of course I'd want similar mappings for other letters that can have accents on them.)
Any ideas on how to deal with this?
Comments
Comment #1
dan3h CreditAttribution: dan3h commentedI found a thread about this, over at the Chosen library's (not the drupal module's) issue queue:
https://github.com/harvesthq/chosen/issues/536
Comment #2
dan3h CreditAttribution: dan3h commentedFound a solution. A bit of hacking, but it works.
https://github.com/harvesthq/chosen/issues/536#issuecomment-26087459
chosen.jquery.js
AbstractChosen.prototype.winnow_results
andAbstractChosen.prototype.search_string_match
Then, on the drupal-module side:
chosen.module
and foundchosen_library()
functionchosen.jquery.js
instead ofchosen.jquery.min.js
If someone has a more elegant way of doing this (i.e. not having to hack both a library and a module), please do share.
Comment #3
Dave ReidYeah, this is outside the scope of what the module can do. This is a Chosen library issue.
Comment #4
fakir22 CreditAttribution: fakir22 commenteddan3h's solution #2 is the best so far. As said before, this issue is related to Chosen library and sadly the solution is not merged yet into official Chosen release...
Therefore, there is a sligthly better way to do this so you have to hack only the library, NOT the module.
That's it. Problem solved and you can update Chosen drupal module without loosing the changes on library's side.