[FIX] lang_LT, lang_LV: negative amounts (#185)

Negative amounts were not working (when no currency is used), because
`get_digits` method does not expect `-` sign, which crashes conversion.
To avoid that, we split minus sign from number string and prepare its
word to be used with amount words.

closes: #184
This commit is contained in:
Andrius Laukavičius
2018-08-23 17:39:03 +03:00
committed by Istvan SZALAÏ
parent 1ca8225ea6
commit 39f522f34a
5 changed files with 33 additions and 4 deletions

View File

@@ -89,6 +89,13 @@ class Num2Word_Base(object):
return out
def parse_minus(self, num_str):
"""Detach minus and return it as symbol with new num_str."""
if num_str.startswith('-'):
# Extra spacing to compensate if there is no minus.
return '%s ' % self.negword, num_str[1:]
return '', num_str
def to_cardinal(self, value):
try:
assert int(value) == value