mirror of
https://github.com/bblaz/num2words.git
synced 2025-12-06 14:52:25 +00:00
Add support to pt_BR language
This commit is contained in:
@@ -36,7 +36,7 @@ class Num2Word_Base(object):
|
||||
self.set_numwords()
|
||||
|
||||
self.MAXVAL = 1000 * self.cards.order[0]
|
||||
|
||||
|
||||
|
||||
def set_numwords(self):
|
||||
self.set_high_numwords(self.high_numwords)
|
||||
@@ -64,7 +64,7 @@ class Num2Word_Base(object):
|
||||
for elem in self.cards:
|
||||
if elem > value:
|
||||
continue
|
||||
|
||||
|
||||
out = []
|
||||
if value == 0:
|
||||
div, mod = 1, 0
|
||||
@@ -75,7 +75,7 @@ class Num2Word_Base(object):
|
||||
out.append((self.cards[1], 1))
|
||||
else:
|
||||
if div == value: # The system tallies, eg Roman Numerals
|
||||
return [(div * self.cards[elem], div*elem)]
|
||||
return [(div * self.cards[elem], div*elem)]
|
||||
out.append(self.splitnum(div))
|
||||
|
||||
out.append((self.cards[elem], elem))
|
||||
@@ -101,7 +101,7 @@ class Num2Word_Base(object):
|
||||
|
||||
if value >= self.MAXVAL:
|
||||
raise OverflowError(self.errmsg_toobig % (value, self.MAXVAL))
|
||||
|
||||
|
||||
|
||||
val = self.splitnum(value)
|
||||
words, num = self.clean(val)
|
||||
@@ -124,7 +124,7 @@ class Num2Word_Base(object):
|
||||
for i in range(self.precision):
|
||||
post *= 10
|
||||
curr = int(post)
|
||||
out.append(str(self.to_cardinal(curr)))
|
||||
out.append(self.to_cardinal(curr))
|
||||
post -= curr
|
||||
|
||||
return " ".join(out)
|
||||
@@ -183,7 +183,7 @@ class Num2Word_Base(object):
|
||||
def set_wordnums(self):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
def to_ordinal(value):
|
||||
return self.to_cardinal(value)
|
||||
|
||||
@@ -260,6 +260,6 @@ class Num2Word_Base(object):
|
||||
_ordnum = self.to_ordinal_num(value)
|
||||
except:
|
||||
_ordnum = "invalid"
|
||||
|
||||
|
||||
print ("For %s, card is %s;\n\tord is %s; and\n\tordnum is %s." %
|
||||
(value, _card, _ord, _ordnum))
|
||||
|
||||
Reference in New Issue
Block a user