Proper British language tools in Libreoffice

UPDATE March 2013: It seems something has broken this way of setting up the British English dictionaries. Skip to the bottom for my suggestion.

An annoying and apparently long-standing bug in OO/OOo/Libreoffice is that a British English dictionary and thesaurus are absent, and won’t appear even after trying all the usual, obvious routes.

The option under Tools -> Language Tools -> Thesaurus stays greyed out regardless of what packages you install, and crucially all the packages you’d expect to install to solve the problem – hunspell-en-gb, hyphen-en-gb, mythes-en-gb, for example – don’t exist, even though other anglophone alternatives such as en-au, en-ca, and even en-za, do. Installing British English dictionary/thesaurus from the Libreoffice Extension Manager website doesn’t help either. Installing the libreoffice-l10n-en-gb localisation package only fixes the Libreoffice interface and suggests the obsolete en-gb versions of language tools above that don’t exist, which only adds to the confusion.

The answer is that the en-gb dictionary and thesaurus is included within the en-us versions, something made clear absolutely nowhere, although it is alluded to obliquely, for example:


$ sudo apt-get install mythes-en-gb
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'mythes-en-us' instead of 'mythes-en-gb'
mythes-en-us is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

This is explained at the bottom of this bug report, which also details a handy, albeit dirty, fix.

1. Ensure you have the guts of the programs you need to use spellchecking and thesaurus at all:

$ sudo apt-get install libmythes-1.2-0 hunspell

2. Next you’ll need to install the en-us versions, as they contain the en-gb versions (you could do this all in one apt-get install command, I’m just making it clear):

$ sudo apt-get install mythes-en-us hunspell-en-us

3. Finally, create symbolic links between the en-us and non-existent en-gb versions so that Libreoffice sees them.

$ cd /usr/share/mythes/
$ sudo ln -s th_en_US_v2.idx th_en_GB_v2.idx
$ sudo ln -s th_en_US_v2.dat th_en_GB_v2.dat

And that should do it. Restart Libreoffice, and check in Tools -> Options -> Language Settings -> Writing Tools that by clicking Edit you can see ‘OpenOffice New Thesaurus’ has appeared under the Thesaurus category. The Thesaurus option should now have reappeared, so you can press CTRL+F7 to bring up the dialog, make sure you select English UK from the Language box on the right (otherwise it displays results from both languages) and look for a Britishism like ‘grey’ or ‘colour’. It’s all there, apart from “a lot of the British swear words“, apparently – but then Americans never did have a clue what bollocks were anyway.

(thanks to Tom Brossman for spotting a stray hyphen typo in the package names)

UPDATE: I’ve tried playing with the Libreoffice dictionary extensions again and still can’t get them to recognise the difference between UK/US spelling, as they unhelpfully accept both. For sanity’s sake I’ve elected to start over with a package that actually does what it says it will (as mentioned in the comments). So:

1) Remove the US dictionary hunspell-en-us (but not the core hunspell spellchecker):
$ sudo apt-get remove hunspell-en-us

2) Install a GB dictionary – hunspell is backwards compatible with myspell, they use the same format:
$ sudo apt-get install myspell-en-gb

Notice that it actually installs the dictionary in /usr/share/hunspell, not /usr/share/myspell/dict – presumably because it recognises that we’re using hunspell (it’s installed) not myspell (it isn’t) as the spellcheck engine. Instead it puts links into the myspell directory for compatibility.

3) That’s it. Keep mythes-en-us (or install it if necessary: $ sudo apt-get install mythes-en-us) because it does actually include GB spellings (you can grep the files for colour, theatre, specialise, etc), and as long as the symbolic links to the non-existent GB thesaurus files (as in step 3 above) are in the directory, Libreoffice will recognise it, and will show Hunspell (UK) and Thesaurus (UK) modules enabled in Tools -> Options -> Language settings -> Writing aids.




10 Comments

  1. JPeg wrote:

    I just found something interesting.
    hunspell-en-gb doesn’t exist but myspell-en-gb contains the following files among others…

    /usr/share/hunspell/en_GB.aff
    /usr/share/hunspell/en_GB.dic
    /usr/share/myspell/infos/ooo/myspell-en-gb
    /usr/share/myspell/dicts/en-GB.dic
    /usr/share/myspell/dicts/en-GB.aff
    /usr/share/myspell/dicts/en_GB.dic
    /usr/share/myspell/dicts/en_GB.aff

    The british english extension seems to work well now.

  2. Dave Martin wrote:

    Brilliant – thanks!

  3. Lorenzo wrote:

    Thanks. At last I have a thesaurus in LO on debian testing :)

  4. John wrote:

    Thank you very much for this.

  5. Alec wrote:

    Thanks,

    How do I do i get rid of color, specialize etc. as these are showing up as valid uk spellings

  6. Peter wrote:

    Thanks for this. Similar trick works for hyphenation too, install mythes-en-us then:

    cd /usr/share/hyphen/
    sudo ln -s hyph_en_US.dic hyph_en_GB.dic

  7. Rowan wrote:

    Thanks for the helpful instructions for this novice!

  8. Jeff wrote:

    Thank you so much for this fix. Greatly appreciated.

  9. Valyo Gennoff wrote:

    Awesome! Thank you very much indeed!!!!!!!!