Open jacmaes opened 12 years ago
Good idea, and it's possible.
Probably the way to solve it is to replace the accents (latinize?) in the search cache on first load, and replace them in search term too right before querying (in case anyone does use them).
Hi there,
Can you give an example of how to accomplish this ?
Thanks.
+1
Hi, add this code to the plugin:
var rExps = [{ re: /[\xC0-\xC6]/g, ch: "A" }, { re: /[\xE0-\xE6]/g, ch: "a" }, { re: /[\xC8-\xCB]/g, ch: "E" }, { re: /[\xE8-\xEB]/g, ch: "e" }, { re: /[\xCC-\xCF]/g, ch: "I" }, { re: /[\xEC-\xEF]/g, ch: "i" }, { re: /[\xD2-\xD6]/g, ch: "O" }, { re: /[\xF2-\xF6]/g, ch: "o" }, { re: /[\xD9-\xDC]/g, ch: "U" }, { re: /[\xF9-\xFC]/g, ch: "u" }, { re: /[\xC7-\xE7]/g, ch: "c" }, { re: /[\xD1]/g, ch: "N" }, { re: /[\xF1]/g, ch: "n" }]; $.each(rExps, function() { filter = filter.replace(this.re, this.ch); innerText = innerText.replace(this.re, this.ch); });
before :
if (innerText.toLowerCase().indexOf(filter) >= 0) {
Hi there,
I love this plugin, but I have one request. Would it be possible to broaden the search for accented characters in foreign language?
Let me explain with one concrete example:
In Spanish, I want to look for the word "adaptation", which would translate to "adaptación". If I type "adaptación", it works as expected. Now if I type "adaptacion", .i.e. without the accent on the "a", it fails to recognize that term.
In Spanish it is (unfortunately) a common practice to omit accents when searching for something because it requires for extra keystroke, and people are lazy.
Thanks.