Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove accents on search for other languages #1880

Closed
Victor-arias opened this issue Apr 8, 2014 · 1 comment
Closed

Remove accents on search for other languages #1880

Victor-arias opened this issue Apr 8, 2014 · 1 comment

Comments

@Victor-arias
Copy link

In Spanish there are letters with accents (tildes), when looking for an accented word without the right accent the word is discarded.

For example in spanish the action word is written as "acción", that is not equal to "accion".

I use a Javascript function would appreciate inclusion in this wonderful library.

function accentsTidy(s){
  var r = s.toLowerCase();
  r = r.replace(new RegExp("[àáâãäå]", 'gi'),"a");
  r = r.replace(new RegExp("æ", 'gi'),"ae");
  r = r.replace(new RegExp("ç", 'gi'),"c");
  r = r.replace(new RegExp("[èéêë]", 'gi'),"e");
  r = r.replace(new RegExp("[ìíîï]", 'gi'),"i");
  r = r.replace(new RegExp("ñ", 'gi'),"n");                            
  r = r.replace(new RegExp("[òóôõö]", 'gi'),"o");
  r = r.replace(new RegExp("œ", 'gi'),"oe");
  r = r.replace(new RegExp("[ùúûü]", 'gi'),"u");
  r = r.replace(new RegExp("[ýÿ]", 'gi'),"y");
  return r;
}

Thank you.

@tjschuck
Copy link
Member

tjschuck commented Apr 8, 2014

Duplicate of #536

@tjschuck tjschuck closed this as completed Apr 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants