GNOME Bugzilla – Bug 127338
spell checking
Last modified: 2005-07-28 21:40:45 UTC
Hi, it's not really a bug but I prefer a spell checker looking at my words :). To make it easy for you the changes to the source code could look like this one (for the version 0.6): -------------------------------------------------------------------------- diff -r -u gossip/configure.in gossip.spell/configure.in --- gossip/configure.in 2003-11-18 20:59:53.000000000 +0100 +++ gossip.spell/configure.in 2003-11-18 22:19:01.000000000 +0100 @@ -63,6 +63,7 @@ loudmouth-1.0 >= $LOUDMOUTH_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED + gtkspell-2.0 ]) # Sucks that we need to do this diff -r -u gossip/src/gossip-chat.c gossip.spell/src/gossip-chat.c --- gossip/src/gossip-chat.c 2003-11-18 12:51:30.000000000 +0100 +++ gossip.spell/src/gossip-chat.c 2003-11-18 22:17:16.000000000 +0100 @@ -25,6 +25,7 @@ #include <string.h> #include <gdk/gdkkeysyms.h> #include <gtk/gtk.h> +#include <gtkspell/gtkspell.h> #include <glade/glade.h> #include <libgnome/gnome-i18n.h> #include <libgnomeui/gnome-href.h> @@ -365,6 +366,8 @@ gossip_chat_view_set_margin (priv->view, 3); gtk_widget_grab_focus (priv->input_entry); + + gtkspell_new_attach(GTK_TEXT_VIEW(priv->input_text_view), NULL, NULL); } static void diff -r -u gossip/src/gossip-group-chat.c gossip.spell/src/gossip-group-chat.c --- gossip/src/gossip-group-chat.c 2003-11-17 18:47:56.000000000 +0100 +++ gossip.spell/src/gossip-group-chat.c 2003-11-18 22:18:52.000000000 +0100 @@ -23,6 +23,7 @@ #include <config.h> #include <string.h> #include <gtk/gtk.h> +#include <gtkspell/gtkspell.h> #include <gdk/gdkkeysyms.h> #include <glade/glade.h> #include <gconf/gconf-client.h> @@ -327,6 +328,7 @@ group_chat_setup_tree (chat); gossip_chat_view_set_margin (chat->view, 3); + gtkspell_new_attach(GTK_TEXT_VIEW (chat->input_text_view), NULL, NULL); } GossipGroupChat * ------------------------------------------------------------------------- There's a rub in it. It only works for GTK_TEXT_VIEW(priv->input_text_view) and not for the one line input "input_entry". Maybe gnome-spell is a better solution but so far I had no look at it.
That is no problem at all! :) Becuase .... *drum rolls s'il vous plait' .... the entry will be a text entry for the next release :) Adding PATCH keyword, marking for 0.7. We'll take a closer look at the patch when things are a bit less hectic. Thanks!
I obviously shouldn't try to get all the monkeys in line playing the drums while I talk. I mean that the text entry will be a text area.
Marking as depending on the bug of using textarea always in chat windows.
I know you are probably doing this, but lets make this optional. Check for it when configuring, if it exists enable the feature. Have a --disable-spellcheck flag as well.
How should this handle i18n by the way? It would be cool if it would be usable for those who chat in different languages at the same time... maybe too hard to do in a nice way, dunno.
evolution can handle multi language spell checking but they are using gnome-spell.
I just tried this, pretty cool, although there are quite a few problems with gtkspell. 1. The UI is not translated 2. The UI is pretty rough, doesn't really fit Gossip (the right click menu for misspelled words are crack) 3. You can't have more than one language spellchecked which I think is too limited, especially since a lot of people are using Gossip in an international context (at least the GNOME developers, dunno if we should care about that though). So, I vote for using gnome-spell (if it doesn't have the above problems) or nothing at all.
Conclusion => not for 0.7.
Marking as enhancement and removing the PATCH keyword since we need to try it out with gnome-spell since gtk-spell doesn't live up to the requirements.
Created attachment 32708 [details] [review] Patch using Gnome Spell instead of GtkSpell I have spent some time this evening looking into this - including the crash course in Bonobo / ORBit / Corba :S This adds the nice little red squiggle when words are misspelled. This patch is very basic. Current issues: - No support to show a list of similar words for correcting the spelling yet. - The language used is taken via the $LANG variable using the gnome-i18n API and might not be right way of doing it?!? - The method for looking up incorrect spellings is inefficient at the moment and could be improved.
We really should look into if we can solve this without the use of bonobo/ORBit. Richard gave gnome-spell a quick look and said that it looked like it just used aspell without much extra. Maybe we can go directly against aspell, I really don't want all the stubs/skels generation stuff in Gossip. Been there, done that, not doing it again! As for possibility to do spell correction I don't think it's needed. I think it might be enough to just indicate wrongly spelled words. Perhaps with the possibility to launch gnome-dict and do a search on the specific word. Not sure how to best solve which languages it should spell check, maybe per contact and some global setting. For example I might want to check for english as default but with Richard I want to have swedish as well...
Created attachment 32724 [details] [review] updated gtkspell patch to the latest gossip cvs version So maybe we should go the gtkspell way and improve their language selection? I'm using it for nearly a year and the only feature I've missed so far is to use more then one language (oh, and the language cooser dialog, of cause). I've updated my patch to the latest gossip version.
Michael, how about the comments from Richard. Are they fixed yet? Ie. the roughness of gtk-spell UI and the lack of translation there? Also, we need to solve the problem where you want to chat in several languages...
Micke, >1. The UI is not translated that works for me. (see http://www.johalla.de/~michael/images/gossip-gtk-spell.jpg) >2. The UI is pretty rough, doesn't really fit Gossip (the right click menu for misspelled words are crack) It's the same with gnome-spell but there you have to do an extra click to get to a dialog box. I prefer the gtk-spell way. (see http://gtkspell.sourceforge.net/screenshot.png and http://www.johalla.de/~michael/images/evolution-gnome-spell.jpg). >3. 3. You can't have more than one language spellchecked which I think is too limited, especially since a lot of people are using Gossip in an international context (at least the GNOME developers, dunno if we should care about that though). Jup, that isn't fixed so far. I don't think it's hard to add to gtk-spell because gtk-spell is not very tricky (see http://cvs.sourceforge.net/viewcvs.py/gtkspell/gtkspell2/gtkspell/gtkspell.c?rev=1.14&view=auto).
I don't particulary like the popup-menu with suggested words. Why not just show the word and make it possible to run gnome-dict on a misspelled word?
Personally I would like to see a list of possible words *somehow* without going to gnome-dict. How could we replace the word using gnome-dict other than correcting the word ourselves (which is not really assisting the user)? There are some other things you can do with the gnome-spell (and probably gtkspell) stuff, such as adding words particular to you to your dictionary so they are not highlighed in the future. Would we want support for that? But then, if we did, and you speak in more than one language, which language would you add the word too? I guess that would be based on the language for that chat window. As far as multi language support is concerned, I guess it is tricky, what happens if you are talking to richard and you send him some english text? We could always allow ALL languages you specify and not be explicit about it? (i.e. if the word is not found in both Swedish and English, then it is marked as misspelled). I can try and do another patch without using corba/ORBit/bonobo if you like.
Created attachment 32789 [details] [review] Patch to use aspell directly. I think this patch is much better than the Gnome Spell patch personally. Also, when you set the language, you use a string in the format of "en_GB" instead of "en" like with Gnome Spell. I have made it use the $LANG environment variable and if not, fall back to "en_US" for this patch.
Martyn: very nice, works well here.
Using enchant here would probably be the right thing to do (http://www.abiword.org/enchant/) instead of relying on aspell directly. gtk-spell in cvs or with patch & gnome-spell with patch already use enchant as backend.
Martyn: Is you patch done or is there something missing? I would love to see spell checking in gossip as soon as possible. So if it is not ready for the gossip cvs what features are missing? And what is with the comment from foser about using enchant instead of aspell?
From what I can see in the patch we need a couple of things before being done: 1) We need to be able to popup a dialog with suggested replacements. 2) Look into using enchant. 3) Need to make an option to turn spell checking on/off 4) Break the checking code out into it's own file and disable the aspell/enchant calls in there instead of putting lots of #ifdefs all over the code. (for example gossip-spell.[ch] and call that all the time and if we don't have the spell checking layer (or have spell checking turned off) we just return that all words are correctly spelled
I looked into enchant briefly. Advantages: * Supports multiple backends which has the benefit of providing the best from the selection of installed dictionaries. * Has a pretty clean API from what I can see. Disadvantages: * It is another dependency for Gossip and ASpell is usually already installed on most systems. The backends it supports are: * Aspell/Pspell (intended to replace Ispell) * Ispell (old and could be interpreted as defacto standard) * MySpell (an OOo project, also used by Mozilla) * Uspell [primarily Yiddish, Hebrew, and Eastern European languages - hosted in AbiWord's CVS under the module "uspell"] * Hspell [Hebrew] I did install libenchant and it has a pkgconfig .pc file, so adding it to the list of libraries Gossip uses should be quick and painless. Personally though, I think we should get something going with aspell first and then move to use enchant if it suits. Using aspell is incredibly easy and quick to do and if we have a gossip-spell module anyway, we can create the functions for the gossip-chat modules to use and simply change the back end later if needs be. I'm not sure if I will get to it this week end, but I will do another patch which does 1), 3) and 4) soon.
Just a comment: First of all I'm fine with finishing the aspell backend first and later switch to enchant if that's easier. I just wanted to say that if gnome-spell/gtk-spell already use enchant it's going to already be in the dependency chain for those who want spell checking. Any possibility of making gnome-spell do what we want and use that? Anyway, these are just thoughts for the future. Please feel free to go ahead with the aspell solution if it will be less work.
On their site they do have a patches to get GtkSpell/Gnome-Spell working with enchant.
Created attachment 33630 [details] [review] Patch to use Aspell with suggestions This patch adds a "Check Word Spelling" item to the context menu when right clicking on a misspelled word and shows a dialog with a list of suggested words to correct the spelling. The user can also turn the spell checking on or off in the preferences.
Comment on attachment 33630 [details] [review] Patch to use Aspell with suggestions Broken due to changes in CVS over the past few months
Created attachment 36304 [details] [review] Updated my last patch so it builds on CVS HEAD. Any chance we can get this patch OK'd for Gossip 0.9? Also, for some reason CVS HEAD doesn't build the marshalls for me? I had to add the line: +GLIB_GENMARSHAL = $(shell pkg-config glib-2.0 --variable=glib_genmarshal) I had to change Makefile.am to use $(GLIB_GENMARSHAL) instead of %GLIB_GENMARSHAL% too.
Checked in this, did some changes: 1) Removed the accidently included gnomemeeting stuff 2) Fixed static function names in gossip-spell-dialog. should be spell_dialog_foo, the dialog part where missing on a few functions. 3) Set the encoding to utf-8 on aspell. 4) Changed so that it was Enable spell check rather than disabling. 5) Added schema entry for the gconf key. I think we need to make it configurable other than just the locale to which language to spell check to. For example I speak mostly in english but have swedish locale.
*** Bug 311525 has been marked as a duplicate of this bug. ***