Difference between revisions of "Adding new dictionaries to aspell"

(How to add a new dictionary to aspell)
(Updating this document to be accurate to Zimbra 8.7, and removing some old 4.X text which is no longer relevant.)
 
(16 intermediate revisions by 9 users not shown)
Line 1: Line 1:
== How to add a new dictionary to aspell ==
+
=Adding new dictionaries to aspell=
 +
<div class="col-md-12 ibox-content">
 +
{{KB|{{Unsupported}}|{{ZCS 8.7}}||}}
  
 +
ZCS 8.7 comes with dictionaries preinstalled for many languages.  ZCS versions 5.0 and earlier only have English installed.  To see the list of installed languages, run
 +
/opt/zimbra/common/bin/aspell dump dicts
  
* Download the dictionary from [ftp://ftp.gnu.org/gnu/aspell/dict gnu.org]
+
If you do not see your language in the list, follow the instructions below.
* Extract it from the tar file in a work directory
 
* Set Zimbra's aspell in the path with:
 
::<tt>PATH=/opt/zimbra/aspell-0.60.3/bin:$PATH</tt>
 
* Configure and install the dictionary according to the README
 
<tt>
 
::./configure
 
::make
 
::make install
 
</tt>
 
  
* Edit the file /opt/zimbra/httpd/htdocs/aspell.php to reference the new dictionary.  For example to add the french dictionary:
+
== How to add a new dictionary to aspell ==
 
+
* Download the dictionary for the language you want from [ftp://ftp.gnu.org/gnu/aspell/dict ftp.gnu.org/gnu/aspell/dict].
<tt>
+
* Extract it from the tar file in a temporary directory.
::$dictionary = pspell_new("en_EN");
+
* Set PATH to the binary directory of Zimbra:
::TO
+
  PATH=/opt/zimbra/common/bin:$PATH
::$dictionary = pspell_new("fr_FR");
+
* Configure and install the dictionary according to the README:
</tt>
 
 
 
 
 
<b>NOTE:</b> I think is better to change the value of the variable <b>$locale</b> at the start of the file.
 
<b>NOTE:</b> If you are using a non-english based language with special chars like tildes (spanish, for example), you have to modify aspell.php
 
 
 
This file is located at /opt/zimbra/httpd/htdocs/aspell.php. Replace this block (line 82 or so)
 
 
 
<pre><nowiki>
 
$suggestions = implode(",", pspell_suggest($dictionary, $word));
 
$misspelled .= "$word:$suggestions\n";
 
</nowiki></pre>
 
 
 
with this one:
 
<pre><nowiki>
 
$suggestions = implode(",", pspell_suggest($dictionary, $word));
 
$suggestions=iconv("iso-8859-1","UTF-8",$suggestions);
 
  $misspelled .= "$word:$suggestions\n";
 
</nowiki></pre>
 
 
 
<b>NOTE:</b> After changing the aspell language restart the spellchecker as the user zimbra with the following command:
 
 
 
<pre><nowiki>
 
zmspellctl stop; zmspellctl start
 
</nowiki></pre>
 
 
 
There is also a problem when splitting words. Replace (line 48 or so)
 
<pre><nowiki>
 
$words = preg_split('/[^\w\'-] /', $text);
 
</nowiki></pre>
 
  
with this one:
+
./configure
<pre><nowiki>
+
make
$words = preg_split('/[^\w\'\xc0-\xfd-]+/', $text);
+
make install
</nowiki></pre>
 
  
This regexp line should be enough for most western Europe languages (Spanish, French, German, Portuguese and Italian). It includes all ISO8859 europeean letters in the range 192-253 of the table below.
+
* Verify the datadir and dictdir it must be '''/opt/zimbra/common/lib/aspell-0.60'''
  
http://www.pemberley.com/janeinfo/latin1.gif
+
You must reload the spell-service:
 +
sudo -u zimbra /opt/zimbra/bin/zmspellctl reload
  
 +
{{Article_Footer|Zimbra Collaboration Suite 8.7|3/9/2017}}
  
* To add a set of custom words see this [http://aspell.sourceforge.net/man-html/Creating-an-Individual-Word-List.html How-To]
+
[[Category:Spell]]
 +
[[Category:Customizing ZCS]]

Latest revision as of 13:05, 9 March 2017

Adding new dictionaries to aspell

   KB 1295        Last updated on 2017-03-9  




0.00
(0 votes)

ZCS 8.7 comes with dictionaries preinstalled for many languages. ZCS versions 5.0 and earlier only have English installed. To see the list of installed languages, run

/opt/zimbra/common/bin/aspell dump dicts

If you do not see your language in the list, follow the instructions below.

How to add a new dictionary to aspell

  • Download the dictionary for the language you want from ftp.gnu.org/gnu/aspell/dict.
  • Extract it from the tar file in a temporary directory.
  • Set PATH to the binary directory of Zimbra:
PATH=/opt/zimbra/common/bin:$PATH
  • Configure and install the dictionary according to the README:
./configure
make
make install
  • Verify the datadir and dictdir it must be /opt/zimbra/common/lib/aspell-0.60

You must reload the spell-service:

sudo -u zimbra /opt/zimbra/bin/zmspellctl reload
Verified Against: Zimbra Collaboration Suite 8.7 Date Created: 3/9/2017
Article ID: https://wiki.zimbra.com/index.php?title=Adding_new_dictionaries_to_aspell Date Modified: 2017-03-09



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »

Jump to: navigation, search