Rev 293 | Rev 295 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 293 | Rev 294 | ||
|---|---|---|---|
| Line 34... | Line 34... | ||
| 34 |
|
34 |
|
| 35 | """
|
35 | """
|
| 36 | _keys = "ipa|en|lit|pos|com|tag|ex" |
36 | _keys = "ipa|en|lit|pos|com|tag|ex" |
| 37 | _expressions = {} |
37 | _expressions = {} |
| 38 | 38 | ||
| 39 | def load (self, dictionary_file): |
39 | def load (self, dictionary_file, language_key='en'): |
| 40 | dictionary = self |
40 | dictionary = self |
| 41 | 41 | ||
| 42 | dmsg('Loading dictionary '.format(dictionary_file), end='', min_level=1) |
42 | dmsg('Loading dictionary '.format(dictionary_file), end='', min_level=1) |
| 43 | 43 | ||
| 44 | chdir(dirname(realpath(__file__))) |
44 | chdir(dirname(realpath(__file__))) |
| Line 57... | Line 57... | ||
| 57 | value = None |
57 | value = None |
| 58 | with open(dictionary_file) as f: |
58 | with open(dictionary_file) as f: |
| 59 | indent = None |
59 | indent = None |
| 60 | 60 | ||
| 61 | for line in f: |
61 | for line in f: |
| 62 | m = match(r'^\s*vuh:\s*(?P<phrase>.+)', line) |
62 | m = match(r'^\s*{0}:\s*(?P<phrase>.+)'.format(language_key), line) |
| 63 | if m is not None: |
63 | if m is not None: |
| 64 | phrase = m.group("phrase") |
64 | phrase = m.group("phrase") |
| 65 | dictionary[phrase] = {} |
65 | dictionary[phrase] = {} |
| 66 | indent = None |
66 | indent = None |
| 67 | else:
|
67 | else:
|