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: https://wiki.gnome.org/Initiatives/SpellChecking

(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 - snapcraft.io

Has been done something here?

We’ve the same issue with aspell, supporting it was quite a bit more complex and also it requires lots of data.

So I’m wondering what would be the best solution:

  • Expose host dictionaries (i.e. access to /var/lib/aspell would be enough)
  • Create a single snap providing all the dictionaries
    • Create single snaps that can provide dictionaries per language.
1 Like

well, is the approach from @Lin-Buo-Ren not working for you ?

Well should probably make a content snap with aspell too, I feel would be better if someone else could maintain it though.

Try creating and validating the package first; then, we can see if Canonical or, maybe, Snapcrafters, pick it up. Might help with this. I would bet on Canonical though, especially since it may affect Firefox too.