about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/inputmethods/ibus-engines/ibus-typing-booster/hunspell-dirs.patch
blob: 7b624b379a26425d6090bcbbb24cfee60e2215c3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
diff --git a/engine/itb_util.py b/engine/itb_util.py
index ded236a..633525a 100755
--- a/engine/itb_util.py
+++ b/engine/itb_util.py
@@ -1876,14 +1876,18 @@ def find_hunspell_dictionary(language):
             If no dictionary can be found for the requested language,
             the return value is ('', '').
     '''
-    dirnames = [
-        '/usr/share/hunspell',
-        '/usr/share/myspell',
-        '/usr/share/myspell/dicts',
-        '/usr/local/share/hunspell', # On FreeBSD the dictionaries are here
-        '/usr/local/share/myspell',
-        '/usr/local/share/myspell/dicts',
-    ]
+
+    if "NIX_HUNSPELL_DIRS" in os.environ:
+        dirnames = os.environ["NIX_HUNSPELL_DIRS"].split(":")
+    else:       # fallback to the original behavior
+        dirnames = [
+            '/usr/share/hunspell',
+            '/usr/share/myspell',
+            '/usr/share/myspell/dicts',
+            '/usr/local/share/hunspell', # On FreeBSD the dictionaries are here
+            '/usr/local/share/myspell',
+            '/usr/local/share/myspell/dicts',
+        ]
     dic_path = ''
     aff_path = ''
     for language in expand_languages([language]):