[wp-polyglots] Spellchecking in your language

Mohd Tarmizi tarmiziaffandi at yahoo.com
Mon Apr 30 01:39:48 GMT 2007


The default TinyMCE install in WordPress comes with the spellchecker plugin
built-in. I've tried searching in the Codex for instructions on how to
add languages in the dictionary list, but found none. Then, after consulting
the TinyMCE wiki (http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker)
and examining the source code
(wp-includes/js/tinymce/plugins/spellchecker/config.php), I've found that the
spellchecker uses one the following engines to work:

1. PHP's internal pspell module.
2. Unix's command line pspell (or any other variant)
3. Google's spellchecking service (available in Gmail)

Note that the WordPress installation uses the engines mentioned above
*sequentially*, i.e. if the first one does not exist, falls down to the second
engine, and so forth. In simpler words (and perhaps more understandable English
^_^;), if PHP doesn't have the internal pspell function, TinyMCE will use pspell on
the command line. Finally, if pspell/aspell is not available in your machine, or if
it doesn't have the dictionary needed, TinyMCE will use Google spellchecker via
PHP's CURL.

I want to point out that it would be nice if the localized WordPress has also a
localized spell checker. Means that if you use German version of WordPress, and
write your posts in German, then an enabled German spell checker would be great.

So, how to do this? I haven't found any instruction in the Codex or any other
source, but after some experimentation, I have found that the following steps work
(I will use German language for this example):

1. Install the appropriate dictionary. Check
"ftp://ftp.gnu.org/gnu/aspell/dict/0index.html" for a list of available
dictionaries. Debian users may use this command to install German dictionary:

sudo apt-get install aspell-de

2. Open "wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js", then search for
this line:

var i, ar = tinyMCE.getParam('spellchecker_languages', '+English=en').split(','), p;

...and change to this:

var i, ar = tinyMCE.getParam('spellchecker_languages', '+English=en,Deutsch=de').split(','), p;

...and save the file.

This seems like code hacking, if anyone could point out any other way of changing
TinyMCE spellchecker config, do tell!


To test if it works, log in to WordPress, go to Write > Write Post, and open up the
spellchecker menu. "Deutsch" will be available. Check it, and write this in the
editor box:

Sprechen Siee Englisch?

...and press the spellcheck button. If it works, only the word "Siee" will be marked
as incorrect (the correct spelling is "Sie").

The only drawback to this method is that regular users may need to tell their server
administrators to install the appropriate dictionary. Hopefully, there's Google.
But I haven't figure out yet on how to use Google's spell checker. It doesn't seem to
check the spelling. Any ideas?




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the wp-polyglots mailing list