Desktop: allow access to host hunspell dictionaries

As was done by @jamesh for system fonts, I wonder if we could expose to snaps hunspell dictionaries installed on the host, through the desktop interface.

I have just added support for spellchecking to the libreoffice snap, and I can imagine that other snaps might want to do the same. This involves adding all relevant hunspell-* and myspell-* dictionaries to stage-packages, and exporting the DICPATH environment variable to allow hunspell to locate them inside the snap. This is not ideal as shipping all those dictionaries makes the snap larger, whereas typically on a desktop the user will have installed only the dictionaries that she needs, not all of them.

Thoughts? Suggestions?

1 Like

Hmmm, I think this is interesting and goes hand-in-hand with font sharing. Is the location of those dictionaries the same across various desktop systems and distributions?

FYI, there is also aspell, hspell, ispell, voiko and zemberek that are all (in addition to hunspell and myspell) supported by the Enchant spell checking frontend. This request is going to be more difficult than the fonts one since there are so many different dictionary directories and different distributions are going to have the host dictionaries in different places.

Where enchant is discussed as the backend for GNOME applications:

(also useful to understand the complexity of spell checking)

If dictionaries are more variable than fonts, might it be worth using the content interface? Treat dictionaries like plugins provided by individual snaps that could plug into any apps needing spell checking.

1 Like

Thanks for the additionial input Jamie! This is indeed more difficult than it looks at first. Something to think about anyway.

And there are dictionaries for hyphenation and thesaurus too. For those I’ve had to patch libreoffice as it looks them up in a hardcoded location that’s set at build time, there’s no way to override that location with an environment variable.

I’ve crafted a hunspell-dictionaries content snap:
Intent-To-Package: Hunspell Dictionaries (Content Snap) - snap -