Google Spell Checker

30th Mar 2006 Danny

Using Google Spell

One of the nice features of this plugin, is that the user interface is intuitive and fairly straight forward.

  1. ENTER TEXT: It's difficult to spell check without text (spell checker tries, diligently reporting back: "No Spelling Errors Found", if the form is blank). The text will be entered into either the write/edit box in the Back Office, or via the comment form (for those wishing to enable spell checking for comments).

  2. CLICK "Check spelling": The plugin connects with Google's Spell Check API, changing the color of the background and styling suspected misspellings.

  3. FIX mistakes: Quickly scan the document, looking at the highlighted words, finding those that need correcting. Clicking a suspect word will pull up a word list, showing suggested corrections (if any). Click on the correctly spelled word on the list, to replace the incorrect one. If the correct one isn't on the list, there's a spot for you to manually enter a correction. If you get "click happy" and select the wrong correction, the interface allows you to return to the orignal word (handy if you've drunk a lot of coffee, beer, wine or whiskey). ;) Continue through the document, until you've made all the necessary corrections.

  4. RESUME editing: Once you've finished with spell checking, click the control panel "Resume Editing", to return to the Back Office edit/write window. Your document has been checked and you can now "save" or continue editing your post. (It's important to remember to click "resume editing" BEFORE "Save!". If you don't, you won't break anything, but you will lose any spell-check changes you've made.)

That's all there is to the spell checker. It really is, that easy, which is why we think that it makes a useful addition to your back office toolset.

A Bit About Foreign Languages

Google's API currently supports eight different languages. Switching from one to another is easy. The right-most control is a drop-down button. Clicking it will reveal a list of the languages. Change your selection and it will be stored in a cookie, which means that you don't have to re-make your change, each time you spell check a document in the Back Office.

Unless you are expecting to write documents in multiple languages, or receive multi-lingual comments, there really isn't a need to switch between languages. You probably could set it to your local language and not offer a choice. If this is what you want to do, then set your default language and disable the language-switching capability, by following the instructions in the light-bulb pop-up.

Default Language: English is the default language, but you can change it to be whatever you want. To do so, open up the googlespell.js file (in the /googlespell_plugin/rsc folder). Change the first variable in the file (immediately after the top comments) to the two-letter designation for the language you wish to be your default (red bit below):

PHP:

var GOOGIE_CUR_LANG "<span style="color:red"><strong>en</strong></span>";

Disable Language Switching: In the same googlespell.js file, just below where the default language is set, you'll find the following line. Disabling the switching capability is as simple as changing "true" to "false":

PHP:

this.show_change_lang_pic = <span style="color:red"><strong>true</strong></span>;

Currently, there is not a facility to add new languages, as it is really up to Google to do that. We apologize, if your language isn't one of the eight supported ones and we would recommend that you contact Google, requesting that your language be added. One point of contact, we can suggest, would be "api-support at google.com". Let them know that you would find the spell-check API very useful, but only if their dictionary database were expanded to include your language.

Control Bar Placement & Styling

Back Office Control Panel Location: By default, the spell checker shows up in the toolbar section, putting the controls to the top and right, just like it is for Gmail. If you would prefer to display the spell checker controls below the textarea, in the Action button section, then do the following:

  • For b2evolution v1.8: It's easy. Make the choice in the settings for the "Back Office Spell Checker Location" (Toolbar = Above, Action Button = Below).

  • For b2evolution v1.6: It's not quite as easy. You'll need to edit the _googlespell_plugin.php file in the /plugins folder. Look for the "Event Handler" section that's called "when displaying editor buttons" (around line 83). Make sure all the colored bits below are in your file, then choose bottom|top based on which variable you use in the last line (choose one, or the other and leave out the | vertical bar):

    PHP:

    /**
         * Event handler: Called when displaying editor buttons.
         *
         * @param array Associative array of parameters
         * @return boolean did we display ?
         */
        function DisplayToolbar( & $params )
        {
        
            <span style="color:blue"><strong>echo '<div class="edit_toolbar" id="spellbox" style="text-align:right"></div>';</strong></span>
            return true
        }
     
        function DisplayEditorButton( & $params )
        {
            global $baseurl$plugins_subdir;
            <span style="color:red"><strong>echo '<span id="spellbutton"></span>';</strong></span>
     
            ?>
      <script type="text/javascript">
      var googie1 = new GoogieSpell("<?php echo $baseurl.$plugins_subdir ?>googlespell_plugin/rsc/", "<?php echo $baseurl.$plugins_subdir ?>googlespell_plugin/rsc/xmlproxy.php?lang=", "<?php echo T_('Check spelling'?>", "<?php echo T_('Resume editing'?>" );
        <?php 
     
            echo 'googie1.decorateTextarea("content", "<span style="color:red"><strong>spellbutton</strong></span>|<span style="color:blue"><strong>spellbox</strong></span>");';
        ?>

rs placement of the controls, but you can also style the window and the controls, to your liking. The CSS is contained in a googlespell.css file, which is stored in the /plugins/googlespell_plugin/rsc folder. You can change the control images, text and formatting. Bits are scattered in the javascript files, the googlespell_plugin.php file and the CSS file. It's beyond the scope of this tutorial to cover such individual styling, but we would be curious to see what you do with it. Be sure to write back if you've come up with something unique!

Contents
  1. Introduction
  2. Installation (v1.6)
  3. Installation (v1.8)
  4. Usage & Styling
  5. FAQS & Enhancements
 
 
 
 

36 comments

finally ... the blog works :|
 
05/31/06 @ 21:22
lol, born a comedian huh? :P

¥
 
05/31/06 @ 22:07
Here's a bug report for the 1.8-cvs version (0.3):

it does googie1.decorateTextarea("itemform_post_content",..., but that does not work for the "Edit Comment" textarea, which has another ID. You could now use $params['target_type'] in AdminDisplayEditorButton (which is "Comment" or "Item"), but the easiest and cleanest solution is to use the JS var b2evoCanvas instead, which holds the name of the textarea ID for the item's and comment's form.
 
06/10/06 @ 17:23
Thanks for the heads up Blueyed, I'll hopefully implement all the changes you've suggested later on today. :D

¥

*edit*
I've implemented your suggestions and the 1.8 zip has now been updated.

Blueyed : I couldn't use b2evoCanvas for comments though as it's not available.
 
06/12/06 @ 11:02
Comment from: Dave
Looks like Google has killed the ability to use their toolbar for spell check. Next!
 
06/14/06 @ 19:25
Comment from: stk
Just notced tht the plugn is reprting: "no splling erors" acrss teh board??
 
06/16/06 @ 18:18
Google, in it's infinite wisdon, has moved the api url to an https url. Unfortunately ssl is unavailable on this server which kind of makes it a smidge tough to connect to the new url.

Looks like we need to find another source.

¥
 
06/17/06 @ 09:33
Comment from: stk
Okay ... we need to get SSL support on the AM server, then the demo will work again.

The plugin still works for anyone whose host provides SSL support. (Works on my blog). Yay!

If you haven't done it already, people just need to change line 19 of the "xmlproxy.php" file, replacing the "http" with a "https". (The file is in /plugins/googlespell_plugin/rsc folder).

Why does Google do stuff like this? Odd.

-stk
 
06/22/06 @ 18:01
The zip files have both had the amendment made to them.

I also implemented the js changes sent to us by John McKnight (I don't have a url for him so I can't provide any linkage).

¥
 
06/26/06 @ 09:36
Instead of adding [?php $Plugins->call_by_code( 'goospel', array() ); ?] to your _main skin file, why not use the SkinBeginHtmlHead event, and use that to contain that code, with a plugin setting to determine wether or not it should be used...
 
07/11/06 @ 09:09
Hi Balupton,
At the time the 1.8 version was written that hook wasn't in the cvs. We've slowly been upgrading our plugins to work with the release version of 1.8.

The 1.8 version of the plugin has now been updated, so grab the latest version of the zip file ;)

¥
 
07/14/06 @ 08:24
Comment from: Kyle
In order to fix the https problem, I use a php proxy script from the original site. For anyone interested, you can check it out here:

http://orangoo.com/labs/uploads/sendReq.php

My thought is that instead of me pointing to this script for my installation, maybe the necessary code can be integrated into the plugin? It seems like this method will work for any server, but I haven't tested it. All I know is that with your default install, it failed, but after pointing it to that script, it worked perfectly.

This is just a suggestion/thought I had.
 
07/14/06 @ 20:16
Hi Kyle,
Yeah I made a cockup and forgot the ssl bit when I changed the xmlproxy, this has now been rectified and both zips updated.

Thanks for catching that :D

¥
 
07/15/06 @ 07:55
Comment from: fulcrum
I am using Opera 9 and the Spell Checker controls don't show up. OK, let me be more specific: the controls don't show up on my site and they don't show up on this page (at the top in the 'Google Spell Demostration') however, they show up at the top of this comment text area. JavaScript is enabled so I am not sure what is going on? Any ideas?
 
07/25/06 @ 02:46
Comment from: stk
Fulcrum,

Why Demo Controls are Gone

We're in the process of upgrading this blog from CVS v1.8 to the newly-released v1.8 "Summer Beta". The fact that there was even a demo inside a blog post was a tad special and it used a plugin, which injected some javascript, to allow the demo). I'm not sure if it's the plugin or the JS code that's not functioning at the moment, but that's probably why the demo controls don't show up.

Comment Controls

The comment controls do, which is testimony that the plugin code functions and properly inserts the spell-check controls into the comments section (they're showing up in the backoffice too).

However ... neither work at the moment and this we blame (ultimately) on Google ...

Some time ago, they changed the spell check API to a secure server location (for some strange reason). Hey, they're Google, I guess they can do what they want. In any case, though the script has been modified to take the HTTPS URL change into account, THIS windows-based server that hosts our site, does not currently have SSL support. So, while the controls are there, the spell checking never happens (and we have to be very careful about our spelling).

So ... what version of b2evolution are you trying to use this with?



 
07/25/06 @ 04:30
Hi Fulcrum,

I've updated the 1.8 zip, it should cure all your problems. If it doesn't then send me a link to your blog and I'll see if I can work out why.

¥
 
07/25/06 @ 10:52
Comment from: fulcrum
I downloaded the latest version of the plugin and everything seem to be working. Thank you for the quick turn-around!
 
07/26/06 @ 02:11

it should cure ALL your problems.



LMAO ... that's a mighty big claim there, cowboy ¥! :p
 
07/26/06 @ 03:40
It would be really nice if when the spellchecker failed, that it would notify the user instead of just saying "No errors found". Particulary for errors like failure to connect to google, or no SSL support in PHP, an error message would help get things fixed.
 
08/07/06 @ 22:01
Hi Jeremy,
That's a really cool idea, but I figure it would be a tad tough to incorporate into this version of the plugin.

I'll have a root around in the code and see what I can do. If not then I'm sure it'll make it into the next version of the code ;)

¥
 
08/10/06 @ 08:35
Comment from: MrDav
I installed the plugin on my site, and I get an undefined error when trying to check a comment. So I thought I'd come here and whine. I tried your demo and all I get to see is the little wheel going round and round and not stopping. Is this a known issue? Oops, I just tried to check this comment and got the undefined error message again.

Meanwhile I am going to see if firefox produces the same error. :)
 
08/17/06 @ 18:07
Comment from: MrDav
It seems to work fine in firefox, but not in IE beta3. I guess I will have to turn it off till M$ or AM has a fix.

;)
 
08/17/06 @ 23:44
Hi MrDav,
I should get chance over the next few days to play with the plugin so I'll see if I can cure your errors at the same time.

It doesn't work on this server because SSL isn't enabled which is needed to connect to google, but that's one of the other things I'm hoping to cure ;)

¥
 
08/18/06 @ 07:53
Comment from: Chim Bon
Excellent plugin!

I have it working in one blog but not in another. Both blogs are at different servers.
How can I tell wether the server with the blog that has the GoogieSpelling not working, has SSL enabled or not?
How do you enable it?

Thank you!
 
10/22/06 @ 14:47
Comment from: Chim Bon
How can I tell wether the server with the blog that has the GoogleSpelling not working, has SSL enabled or not?
How do you enable it?

Can you please answer.
 
11/12/06 @ 17:04
Comment from: Guillermo Casanova
¿Is there a way to establish a language by default? My blogs are in spanish and spanish are the people that comment on them. I want the Default language to be Spanish instead of english. Possible?
 
12/02/06 @ 01:18
Hi,
If you read page 3 Usage and styling, there's a section all about changing the default language.

Chim Bon : You should be able to chack if you have ssl support by looking at your php_info();

¥
 
12/05/06 @ 06:33
Comment from: Guillermo Casanova
¥åßßå: Thank you! Problem solved.

 
12/07/06 @ 22:41
Comment from: khalid
I'm using b2ev 1.9.1 and install this plug-in but no check spelling button does not appear in either Write/Edit in the backoffice.

Where should this button be?
 
01/17/07 @ 07:12
Comment from: Khalid
Sorry, I forget to mention that I can't find a checkbox for spellcheck comments on the backoffice blogsetting for this pluhin even though I inserted the code in Step-4 in my skin _main.php.
 
01/21/07 @ 03:36
Hi Kahlid,
Sorry, we don't do email support for our plugins as it defeats the purpose of having this blog where everyman and his dog can see the solutions to any problems that people may have.

Some of your problems are caused by the fact that this plugin was written a fair tad ago and has never been updated to 1.9.x as FF (the only browser to use ;) ) now has a built-in spell checker.

When I get a chance I'll install this on a 1.9.x blog and see if I can get it working, but it's a tad tough to check as this server doesn't (currently) have SSL support for php

¥
 
01/21/07 @ 13:16
Comment from: Nelson
I am using 1.9 and it works, nice work :)
 
02/17/07 @ 13:50
I'm using 1.9.2 and the spell checker doesn't work. It was fine when I was using 1.8+. The error is as simple as "error Encountered undefined". Now this could be as a result of IE7, but I'm not sure. But when I pushed "Check Spelling" on this commentm it's doing the same thing without the error message. The spiral just keeps spinning, so it may have something to do with IE7.
 
04/07/07 @ 02:47
Comment from: stk
Stephan,

Hmmm. I'm using 1.9.3 (minor difference) with IE7 and the spell checker works for me?

It does rely on a 3rd-party server (google) and a relatively undocumented API and (of course) Google changes the rules and access on a whim. We're not big on the plugin, for those reasons.

You might be interested to know that FireFox 2.0 has a built in spell checker, which you can use natively (no plugin required).

Hope this helps.

stk
 
05/02/07 @ 16:09
Great. I'm using 1.9 and it works =)
 
10/10/07 @ 20:32
I'm using b2evo with the latest version of this plugin and it works great in Firefox. But when I use IE, I can't get it to work - live checking doesn't work, the above mentioned error message comes up when I click the "check now" link, and the popup menu for the language switch appears halfway outside the window to the right. Any chances of a fix for this? Too many people using IE out there :-)

Thanks - great plugin!
Oliver
 
05/23/08 @ 23:16

Comments are closed for this post.

 

B.O.P.I.T