Skip to content

Commit

Permalink
Update the location of Language files for Windows Environment by chec…
Browse files Browse the repository at this point in the history
…king at default installation path
  • Loading branch information
singh-lokendra committed Apr 1, 2019
1 parent 5985fc3 commit 92bce92
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions apertium/__init__.py
Expand Up @@ -2,6 +2,10 @@
from apertium.analysis import Analyzer, analyze # noqa: F401
from apertium.generation import Generator, generate # noqa: F401
from apertium.translation import Translator, translate # noqa: F401
from platform import system
from os import getenv
from os.path import join
from os.path import isdir


if False:
Expand Down Expand Up @@ -38,9 +42,19 @@ def append_pair_path(pair_path): # type: (str) -> None
_update_modes(pair_path)


def append_pair_path_windows():
if system() == 'Windows':
install_path = getenv('LOCALAPPDATA')
apertium_lang_path = \
join(install_path, 'apertium-all-dev', 'share', 'apertium')
if isdir(apertium_lang_path):
append_pair_path(apertium_lang_path)


pair_paths = ['/usr/share/apertium', '/usr/local/share/apertium']
analyzers = {} # type: Dict[str, Tuple[str, str]]
generators = {} # type: Dict[str, Tuple[str, str]]
pairs = {} # type: Dict[str, str]
for pair_path in pair_paths:
_update_modes(pair_path)
append_pair_path_windows()

0 comments on commit 92bce92

Please sign in to comment.