Bug 496925 - Sonnet does not find installed hunspell dictionaries on Nixos
Summary: Sonnet does not find installed hunspell dictionaries on Nixos
Status: RESOLVED FIXED
Alias: None
Product: frameworks-sonnet
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Martin Sandsmark
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-02 10:17 UTC by alister.hood
Modified: 2025-05-30 10:20 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description alister.hood 2024-12-02 10:17:32 UTC
SUMMARY

It seems that sonnet can only use hunspell dictionaries installed in certain hard-coded locations, and does not even look in $DICPATH.  This means that hunspell dictionaries installed on platforms like NixOS or Guix are not available in KDE applications, although they work fine with hunspell itself and other applications that don't use sonnet, like firefox and mousepad, at least if $DICPATH is set.

Ideally I think sonnet should use exactly the same logic to find hunspell dictionaries as the hunspell cli tool does.
It should at least use $DICPATH if that is set, anyway.

STEPS TO REPRODUCE
1.  Install NixOS, including KDE, and a hunspell dictionary e.g.:

  environment.systemPackages = with pkgs; [
    hunspellDicts.en_GB-ise
    kdePackages.sonnet
    ];
  # allow Firefox etc to see our system dictionary
  environment.sessionVariables.DICPATH = "${pkgs.hunspellDicts.en_GB-ise}/share/hunspell";
  services.desktopManager.plasma6.enable = true;
  services.displayManager.defaultSession = "plasmax11";
  services.xserver.enable = true;

2. try calligrawords or some other KDE app and see spellchecking does not work.  Look in the settings and see KDE thinks there are no available dictionaries.

OBSERVED RESULT
Sonnet cannot find any dictionaries, so there is no spellchecking in any KDE apps.
Firefox, hunspell (cli tool), mousepad etc recognise the dictionary and spellchecking works.

EXPECTED RESULT
Sonnet should see the dictionary, and spellchecking should work in KDE apps.

SOFTWARE/OS VERSIONS
Operating System: NixOS 24.11
KDE Plasma Version: 6.2.3
KDE Frameworks Version: 6.8.0
Qt Version: 6.8.0
Kernel Version: 6.6.63 (64-bit)
Graphics Platform: X11

ADDITIONAL INFORMATION
This ticket at NixOS https://github.com/NixOS/nixpkgs/issues/14430 has a checkbox next to the action "fix sonnet: complain upsteam about them not obeying XDG Standard", but I couldn't find a relevant KDE ticket or anything, so I'm not sure how they "complained", and given how old the NixOS ticket is, it seemed worth filing this here.
Note there is also mention there of $XDG_DATA_DIRS being relevant for enchant and firefox; I haven't tested to check that.

Guix has a ticket at https://issues.guix.gnu.org/63934

I see years ago there used to be HUNSPELL_MAIN_DICT_PATH in the sonnet code, which I think might have allowed a custom location to be specified at build time, but that is gone now.
Comment 1 alister.hood 2025-05-30 10:20:57 UTC
OK, this must have been fixed in recent versions as it is now working on NixOS.
Thanks to whoever fixed it!