Installing dictionaries in OpenOffice.org

DISCLAIMER: This article was written quite a few years ago now (sometime around 2003) and refers to an old version of OpenOffice.org that was current when StarOffice 6 was also current. Unless you're running a very old pre-2.0 version of OOo, this article will likely only be of historical interest.

OpenOffice.org (OOo) ships with a US English dictionary, which is fine for our American friends, but not so useful for the rest of us. This tutorial shows you how to download and install dictionaries for other languages, including installing multiple languages, and how to get OOo to see them. Of course, it's also useful for those in the US, as well as the rest of us, when OOo release new versions of the dictionaries. Note that this tutorial doesn't cover StarOffice 6, which uses its own dictionaries.

Downloading the dictionaries
With any OOo module running, go to Tools, Options, OpenOffice.org, Paths and make a note of the path where your dictionaries are kept. On my Mandrake 9.0 installation, they're at /usr/lib/openoffice/share/wordbook/english. On some systems, they're at /usr/local/openoffice/share/dict/ooo, or /usr/lib/openoffice/share/dict; just hunt around until you find where they are kept on your system. Now close down all OOo modules and also close down oooqs (the QuickStarter) if it's running.

Go to http://lingucomponent.openoffice.org/download_dictionary.html and download the spell checking dictionary and the hyphenation dictionary for the language of your choice. You can, of course, download and install more than one language. This tutorial assumes you're going to download the Great British English dictionary and the English hyphenation dictionary, so the files you want are en_GB.zip and hyph_en.zip.

Unpacking the dictionaries
Open an xterm (e.g. Konsole) so that you are at a command line. (If you're new to Linux and you're running KDE, Gnome, or something like either of those, click the icon that looks like a monitor, or select a terminal from the menu.) Enter the 'cd' command followed by the location where your OOo dictionaries are kept. So you'll enter something like:

	cd /usr/lib/openoffice/share/wordbook/english
To unzip the two files you downloaded, enter 'unzip' followed by the path to the .zip files. For example, if you downloaded to ~/downloads (the 'downloads' subdirectory in your home directory) then you'll enter these commands:
	unzip ~/downloads/en_GB.zip
unzip ~/downloads/hyph_en.zip
If you get an error message like this:
	bash: unzip command not found
then you'll need to install the unzip program. How you do that depends on which Linux distro you're using. In Mandrake 9.0, you'd enter 'urpmi unzip' on the command line, which will install the unzip-5.50-2mdk RPM.

NOTE FOR MANDRAKE 9.0 USERS
There's one more thing you'll need to install, if it's not installed already. For some reason, the MySpell dictionary isn't installed by default. You'll find the files for the languages you need on one of the installation CDs. The GB English one is myspell-en_GB-1.0.1-0.20020903.4mdk.rpm. You can install it from the command line by entering 'urpmi myspell-en_GB'. Other distributions might also need the relevant MySpell dictionary installed.

Installing the dictionaries
If you look in your dictionary directory, you'll find en_GB.dic and en_GB.aff (from en_GB.zip) and hyph_en.dic (from hyph_en.zip). If you don't also have a file called 'dictionary.lst' file, you'll need to create it. You can do that by entering 'touch dictionary.lst' on the command line - note that the character after the '.' is the letter l (ell).

You now need to make a couple of entries in the dictionary.lst file, and you can do that using the vi editor. Enter 'vi dictionary.lst'. When vi opens, check to see if you have lines like the following.

	DICT en GB en_GB
HYPH en GB hyph_en
THES en GB th_en_US
The lines in this example are for Great British English. If you're installing a different language, you need to have three similar lines where the 2nd word in each line is the two-letter code for your language ('en' for English in this example), the 3rd word is the two-letter code for your locale ('GB' for Great Britain in this example) and the 4th word is the name of the file to be used as a spelling dictionary, a hyphenation file, and a thesaurus respectively. (Note: the th_en_US thesaurus is installed when you install OOo. It consists of two files: th_en_US.idx and th_en_US.dat.)

To enter the three lines (or amend existing ones), press the 'i' key to put vi into insert mode. You can now use the arrow keys, Page Up and Page Down to move around, and the letter keys to enter the three lines above exactly as shown. Make sure you don't put any spaces at the start of any line or it won't work [thanks to Tomas Påhlsson for pointing this out]. If you make any mistakes, use the Backspace and Delete keys. When you've finished, press the Esc key and you'll see the word '-- INSERT --' disappear from the bottom line. Now enter the following:

	:wq
(that's a semi-colon followed by 'w' for 'write' and 'q' for 'quit). The file will be saved and you'll exit vi and find yourself back at the command line.

Some of you will be installing more than one dictionary. For example, if you work in Great Britain and send documents to the US, you might want both the GB and US dictionaries and hyphenation files installed. Following the above example, your dictionary.lst file will look like this:

	DICT en GB en_GB
HYPH en GB hyph_en
THES en GB th_en_US
DICT en US en_US
HYPH en US hyph_en
THES en US th_en_US

Using language settings in documents
You now need to tell OOo to spellcheck your documents using the appropriate languages. When you enter text into an OOo module, it is assumed to be in the default language. Run Writer now and go to Tools, Options, Language Settings, Languages, and you'll see the 'Default Language for Documents' listed there. OOo will spellcheck using this language by default. If you want to have text in a different language, and have OOo spellcheck that text correctly, you must mark the text accordingly. To do that, you highlight the text, then go to Format, Character, Font, and select the language from the Language dropdown.

If you've installed dictionaries for more than one language, try it now. Enter some text in the default language, then some more text in another language, highlight the second piece of text and format it as that second language. We're shortly going to spellcheck it. If you only have one language installed, enter some text you know is misspelled in that language. For our en_GB example, you could enter 'What is the color?'.

Telling OOo about the changes
Although we've told OOo which language our text is in, we still need to tell it which dictionaries to use for which language. Go to Tools, Options, Language Settings, Writing Aids. Click the Edit button to the right of 'Available Language Modules' and select the default language from the dropdown menu ('English (UK)' for our example). If you've installed everything OK, you should see three entries, something like this:

	Spelling
OpenOffice MySpell SpellChecker

Hyphenation
AltLinux LibHnj Hyphenator

Thesaurus
OpenOffice enUS Thesaurus

Make sure that each has a checkmark against it. If you're installing more than one dictionary, go through the same process for each language: select the language from the dropdown, put checkmarks against each item you want to use for that language. Note that this arrangement allows you to enable or disable each item. Note also that there appears to be only one thesaurus shipped with OOo at the present time. Click Close when you're done and you should see your selections listed 'Available language modules' list.

User-defined dictionaries
While you've got this dialog open, notice that this is where you can define your own dictionaries. Whenever OOo finds a word it doesn't recognise, you have the opportunity to add the word to one of your user-defined dictionaries. For example, you might have one called 'technical'. To define your own dictionary, click the 'New' button, enter a name, and select which language words in this dictionary will belong to. (Note: if you check the 'Exception' box, the dictionary will be treated as an exception dictionary - one which contains words which *won't* be spellchecked in this language.) After you click OK, remember to put a checkmark next to the new user-defined dictionary to ensure that it gets used. You can add words to any user-defined dictionary by highlighting it, then clicking the Edit button.

If you want to add words to your user-defined dictionaries during a spell-checking session, when a word shows up in the Spellcheck dialog as being misspelled, choose the language from the Language dropdown, the user-defined dictionary from the Dictionary dropdown, then click the Add button.

Checking your work
Make sure you have some text in the default language, and some text in any other language(s) you've installed. Make sure that any text that is not in the default language is formatted as such. Also, make sure that at least one word in each block of text is misspelled. Lastly, make sure that all of the text is in a font that you know is installed on your system; this is important as OOo seems to take all text formatted with a non-existent font as being in no particular language, and hence fails to spellcheck it correctly.

Now select Tools, Spellcheck, Check (or just press the F7 key). The first misspelled word should appear in the Spellcheck dialog. Look at the Language dropdown and make sure it matches the language for the text where the word appears in the document. In other words, if you're spellchecking text in the default language, you should see the default language in the Language dropdown.

If you've carried out all of the preceding steps correctly, you should find that spellchecking now works.


I welcome feedback in the form of constructive criticism of this tutorial, or suggestions as to how to improve it. I don't have a lot of time to answer specific questions on OpenOffice.org or StarOffice, so don't e-mail me with those; I hang out in the alt.os.linux.mandrake newsgroup, as well as in comp.os.linux.misc and a handful of others, and you'd best direct your questions there in order to maximize the possibility of getting a response. You can contact me by e-mail at garryknight@gmx.net
My thanks go to Kevin Hendricks for the inspiration.



Site design © Garry Knight 1998-2007