After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 745128 - Search is useless for translated app names
Search is useless for translated app names
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkAppChooser
3.22.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
Cosimo Cecchi
Depends on: 790229
Blocks:
 
 
Reported: 2015-02-24 21:52 UTC by Daniel Korostil
Modified: 2018-03-31 09:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
appchooserwidget: fix search to match unaccented words (3.80 KB, patch)
2017-10-07 08:31 UTC, Nelson Benitez
none Details | Review
GIF showing bug (before patch) (1.32 MB, image/gif)
2017-10-07 08:36 UTC, Nelson Benitez
  Details
GIF showing bug fixed (after patch) (1.42 MB, image/gif)
2017-10-07 08:37 UTC, Nelson Benitez
  Details
appchooserwidget: fix search to match unaccented words (1.89 KB, patch)
2017-11-12 07:30 UTC, Nelson Benitez
none Details | Review
appchooserwidget: search text using g_str_match_string() (2.73 KB, patch)
2017-11-15 15:28 UTC, Nelson Benitez
committed Details | Review

Description Daniel Korostil 2015-02-24 21:52:41 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.
Comment 1 Nelson Benitez 2017-08-24 08:35:36 UTC
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.
Comment 2 Nelson Benitez 2017-10-07 08:31:56 UTC
Created attachment 361088 [details] [review]
appchooserwidget: fix search to match unaccented words
Comment 3 Nelson Benitez 2017-10-07 08:36:18 UTC
Created attachment 361089 [details]
GIF showing bug (before patch)
Comment 4 Nelson Benitez 2017-10-07 08:37:04 UTC
Created attachment 361090 [details]
GIF showing bug fixed (after patch)
Comment 5 Matthias Clasen 2017-10-07 21:44:48 UTC
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.
Comment 6 Nelson Benitez 2017-10-08 08:02:25 UTC
(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().
Comment 7 Nelson Benitez 2017-11-12 07:14:21 UTC
(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.
Comment 8 Nelson Benitez 2017-11-12 07:30:30 UTC
Created attachment 363421 [details] [review]
appchooserwidget: fix search to match unaccented words

by using new g_utf8_unaccent() function provided in bug 790229.
Comment 9 Nelson Benitez 2017-11-15 15:28:28 UTC
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.
Comment 10 Cosimo Cecchi 2018-03-31 00:31:06 UTC
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.
Comment 11 Nelson Benitez 2018-03-31 08:58:36 UTC
(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.