GNOME Bugzilla – Bug 745128
Search is useless for translated app names
Last modified: 2018-03-31 09:00:13 UTC
When I type untranslated "Boxes" in my (Ukrainian) locale it doesn't find any result in AppChooser. Meantime gnome-shell returns both translated name's and original one's relevant results.
Same problem here on spanish locale, the "Videos" application it's "Vídeos" in spanish (same word but with an accented i) and if I just search for "videos" it does not match. Search should be insensitive to accented letters, just like search it's already insensitive to lowercase/uppercase.
Created attachment 361088 [details] [review] appchooserwidget: fix search to match unaccented words
Created attachment 361089 [details] GIF showing bug (before patch)
Created attachment 361090 [details] GIF showing bug fixed (after patch)
It doesn't look right to me to have so much unicode bitfiddling code in gtkappchooser.c - if this is a problem for search in general, then there should be code in glib to handle this situation.
(In reply to Matthias Clasen from comment #5) > It doesn't look right to me to have so much unicode bitfiddling code in > gtkappchooser.c - if this is a problem for search in general, then there > should be code in glib to handle this situation. Yes it seems this function (written by Alexander Morgado) is needed, because if I just use g_utf8_normalize() + g_utf8_casefold() the strings are not matching. I also think this would be a nice add to glib utf8 functions: https://developer.gnome.org/glib/stable/glib-Unicode-Manipulation.html I'm cc'ing Alexander so he can comment on adding said function to glib and/or why using plain g_utf8_casefold + g_utf8_normalize (name, -1, G_NORMALIZE_DEFAULT_COMPOSE) is not working with strncmp().
(In reply to Nelson Benitez from comment #6) > (In reply to Matthias Clasen from comment #5) > > It doesn't look right to me to have so much unicode bitfiddling code in > > gtkappchooser.c - if this is a problem for search in general, then there > > should be code in glib to handle this situation. > > Yes it seems this function (written by Alexander Morgado) is needed, because > if I just use g_utf8_normalize() + g_utf8_casefold() the strings are not > matching. Replying to myself, of course they are not matching as normalize and casefold don't remove diacritics, that's why a function for that purpose is needed. > I also think this would be a nice add to glib utf8 functions: > https://developer.gnome.org/glib/stable/glib-Unicode-Manipulation.html I've posted a patch for adding said function to GLib, on bug 790229, it's based on Alexander's function but expanded to remove any combining character of the Unicode General Category of Nonspacing Mark, while Alexander's function was just removing a few ranges which cover most of diacritics on Latin/European languages.
Created attachment 363421 [details] [review] appchooserwidget: fix search to match unaccented words by using new g_utf8_unaccent() function provided in bug 790229.
Created attachment 363697 [details] [review] appchooserwidget: search text using g_str_match_string() so we match on diacritics (eg. accented letters) and also search on text tokens. As a plus we also reduce code size. --------- New patch using g_str_match_string() as suggested by bug 790229 comment 3 It works for diacritics (tested with spanish accents and german umlauts) and we also get the bonus of searching on tokens eg. searching for "roller" will match on "file-roller" of executable name.
Review of attachment 363697 [details] [review]: I believe that the GLib function did not exist back when this class was written... The patch looks good to me.
(In reply to Cosimo Cecchi from comment #10) > Review of attachment 363697 [details] [review] [review]: > > I believe that the GLib function did not exist back when this class was > written... The patch looks good to me. Thank you Cosimo for paying attention to this bug, patch committed to both gtk-3-22 and master branches.