mirror of
https://github.com/bblaz/num2words.git
synced 2025-12-06 14:52:25 +00:00
[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:
committed by
Istvan SZALAÏ
parent
1ca8225ea6
commit
39f522f34a
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user