Merge pull request #65349 from matthewbauer/dicts

Lookup hunspell dictionaries in XDG_DATA_DIRS
This commit is contained in:
Matthew Bauer 2019-08-14 14:17:41 -04:00 committed by GitHub
commit 9af20c376b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 76 additions and 3 deletions

View File

@ -0,0 +1,37 @@
From 8c67f314de2684d77315eecd99ef091d441f17dd Mon Sep 17 00:00:00 2001
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Wed, 24 Jul 2019 15:35:18 -0400
Subject: [PATCH] Make hunspell look in XDG_DATA_DIRS for dictionaries
Some dictionaries may exist but only show up under XDG_DATA_DIRS. For
instance, $HOME/.local/share/hunspell could contain some dictionaries.
This patch adds each directory in the hunspell subdir of each
XDG_DATA_DIRS to the lookup path.
Upstream pr is available at: https://github.com/hunspell/hunspell/pull/637
---
src/tools/hunspell.cxx | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/tools/hunspell.cxx b/src/tools/hunspell.cxx
index 690e34a..6cd127e 100644
--- a/src/tools/hunspell.cxx
+++ b/src/tools/hunspell.cxx
@@ -2044,6 +2044,13 @@ int main(int argc, char** argv) {
if (getenv("DICPATH")) {
path_std_str.append(getenv("DICPATH")).append(PATHSEP);
}
+ if (getenv("XDG_DATA_DIRS")) {
+ char* dir = strtok(getenv("XDG_DATA_DIRS"), ":");
+ while (dir != NULL) {
+ path_std_str.append(dir).append("/hunspell:");
+ dir = strtok(NULL, ":");
+ }
+ }
path_std_str.append(LIBDIR).append(PATHSEP);
if (HOME) {
const char * userooodir[] = USEROOODIR;
--
2.22.0

View File

@ -14,6 +14,8 @@ stdenv.mkDerivation rec {
buildInputs = [ ncurses readline ];
nativeBuildInputs = [ autoreconfHook ];
patches = [ ./0001-Make-hunspell-look-in-XDG_DATA_DIRS-for-dictionaries.patch ];
postPatch = ''
patchShebangs tests
'';

View File

@ -286,10 +286,11 @@ let
};
};
in {
in rec {
/* ENGLISH */
en_US = en-us;
en-us = mkDictFromWordlist {
shortName = "en-us";
shortDescription = "English (United States)";
@ -300,6 +301,7 @@ in {
};
};
en_CA = en-ca;
en-ca = mkDictFromWordlist {
shortName = "en-ca";
shortDescription = "English (Canada)";
@ -310,6 +312,7 @@ in {
};
};
en_GB-ise = en-gb-ise;
en-gb-ise = mkDictFromWordlist {
shortName = "en-gb-ise";
shortDescription = "English (United Kingdom, 'ise' ending)";
@ -320,6 +323,7 @@ in {
};
};
en_GB-ize = en-gb-ize;
en-gb-ize = mkDictFromWordlist {
shortName = "en-gb-ize";
shortDescription = "English (United Kingdom, 'ize' ending)";
@ -332,126 +336,147 @@ in {
/* SPANISH */
es_ANY = es-any;
es-any = mkDictFromRla {
shortName = "es-any";
shortDescription = "Spanish (any variant)";
dictFileName = "es_ANY";
};
es_AR = es-ar;
es-ar = mkDictFromRla {
shortName = "es-ar";
shortDescription = "Spanish (Argentina)";
dictFileName = "es_AR";
};
es_BO = es-bo;
es-bo = mkDictFromRla {
shortName = "es-bo";
shortDescription = "Spanish (Bolivia)";
dictFileName = "es_BO";
};
es_CL = es-cl;
es-cl = mkDictFromRla {
shortName = "es-cl";
shortDescription = "Spanish (Chile)";
dictFileName = "es_CL";
};
es_CO = es-co;
es-co = mkDictFromRla {
shortName = "es-co";
shortDescription = "Spanish (Colombia)";
dictFileName = "es_CO";
};
es_CR = es-cr;
es-cr = mkDictFromRla {
shortName = "es-cr";
shortDescription = "Spanish (Costra Rica)";
dictFileName = "es_CR";
};
es_CU = es-cu;
es-cu = mkDictFromRla {
shortName = "es-cu";
shortDescription = "Spanish (Cuba)";
dictFileName = "es_CU";
};
es_DO = es-do;
es-do = mkDictFromRla {
shortName = "es-do";
shortDescription = "Spanish (Dominican Republic)";
dictFileName = "es_DO";
};
es_EC = es-ec;
es-ec = mkDictFromRla {
shortName = "es-ec";
shortDescription = "Spanish (Ecuador)";
dictFileName = "es_EC";
};
es_ES = es-es;
es-es = mkDictFromRla {
shortName = "es-es";
shortDescription = "Spanish (Spain)";
dictFileName = "es_ES";
};
es_GT = es-gt;
es-gt = mkDictFromRla {
shortName = "es-gt";
shortDescription = "Spanish (Guatemala)";
dictFileName = "es_GT";
};
es_HN = es-hn;
es-hn = mkDictFromRla {
shortName = "es-hn";
shortDescription = "Spanish (Honduras)";
dictFileName = "es_HN";
};
es_MX = es-mx;
es-mx = mkDictFromRla {
shortName = "es-mx";
shortDescription = "Spanish (Mexico)";
dictFileName = "es_MX";
};
es_NI = es-ni;
es-ni = mkDictFromRla {
shortName = "es-ni";
shortDescription = "Spanish (Nicaragua)";
dictFileName = "es_NI";
};
es_PA = es-pa;
es-pa = mkDictFromRla {
shortName = "es-pa";
shortDescription = "Spanish (Panama)";
dictFileName = "es_PA";
};
es_PE = es-pe;
es-pe = mkDictFromRla {
shortName = "es-pe";
shortDescription = "Spanish (Peru)";
dictFileName = "es_PE";
};
es_PR = es-pr;
es-pr = mkDictFromRla {
shortName = "es-pr";
shortDescription = "Spanish (Puerto Rico)";
dictFileName = "es_PR";
};
es_PY = es-py;
es-py = mkDictFromRla {
shortName = "es-py";
shortDescription = "Spanish (Paraguay)";
dictFileName = "es_PY";
};
es_SV = es-sv;
es-sv = mkDictFromRla {
shortName = "es-sv";
shortDescription = "Spanish (El Salvador)";
dictFileName = "es_SV";
};
es_UY = es-uy;
es-uy = mkDictFromRla {
shortName = "es-uy";
shortDescription = "Spanish (Uruguay)";
dictFileName = "es_UY";
};
es_VE = es-ve;
es-ve = mkDictFromRla {
shortName = "es-ve";
shortDescription = "Spanish (Venezuela)";
@ -505,6 +530,7 @@ in {
/* ITALIAN */
it_IT = it-it;
it-it = mkDictFromLinguistico rec {
shortName = "it-it";
dictFileName = "it_IT";
@ -517,6 +543,7 @@ in {
/* BASQUE */
eu_ES = eu-es;
eu-es = mkDictFromXuxen {
shortName = "eu-es";
dictFileName = "eu_ES";
@ -549,6 +576,7 @@ in {
/* HUNGARIAN */
hu_HU = hu-hu;
hu-hu = mkDictFromLibreOffice {
shortName = "hu-hu";
dictFileName = "hu_HU";
@ -557,7 +585,8 @@ in {
};
/* SWEDISH */
sv_SE = sv-se;
sv-se = mkDictFromDSSO rec {
shortName = "sv-se";
dictFileName = "sv_SE";
@ -565,26 +594,30 @@ in {
};
# Finlandian Swedish (hello Linus Torvalds)
sv_FI = sv-fi;
sv-fi = mkDictFromDSSO rec {
shortName = "sv-fi";
dictFileName = "sv_FI";
shortDescription = "Swedish (Finland)";
};
/* GERMAN */
de_DE = de-de;
de-de = mkDictFromJ3e {
shortName = "de-de";
shortDescription = "German (Germany)";
dictFileName = "de_DE";
};
de_AT = de-at;
de-at = mkDictFromJ3e {
shortName = "de-at";
shortDescription = "German (Austria)";
dictFileName = "de_AT";
};
de_CH = de-ch;
de-ch = mkDictFromJ3e {
shortName = "de-ch";
shortDescription = "German (Switzerland)";
@ -593,6 +626,7 @@ in {
/* UKRAINIAN */
uk_UA = uk-ua;
uk-ua = mkDict rec {
name = "hunspell-dict-uk-ua-${version}";
version = "4.2.5";