mirror of
https://github.com/bblaz/num2words.git
synced 2025-12-06 06:42:25 +00:00
Change implementation of to_currency() in es_ES (#167)
* Change implementation of to_currency() * Change OLD to ESP and add USD
This commit is contained in:
committed by
Ernesto Rodriguez Ortiz
parent
551a980e54
commit
b492530cfa
@@ -22,6 +22,12 @@ from .lang_EU import Num2Word_EU
|
||||
|
||||
|
||||
class Num2Word_ES(Num2Word_EU):
|
||||
CURRENCY_FORMS = {
|
||||
'EUR': (('euro', 'euros'), ('centimo', 'centimos')),
|
||||
'ESP': (('peseta', 'pesetas'), ('centimo', 'centimos')),
|
||||
'USD': (('dolar', 'dolares'), ('centavo', 'centavos')),
|
||||
}
|
||||
|
||||
# //CHECK: Is this sufficient??
|
||||
def set_high_numwords(self, high):
|
||||
max = 3 + 6 * len(high)
|
||||
@@ -165,11 +171,10 @@ class Num2Word_ES(Num2Word_EU):
|
||||
self.verify_ordinal(value)
|
||||
return "%s%s" % (value, "º" if self.gender_stem == 'o' else "ª")
|
||||
|
||||
def to_currency(self, val, longval=True, old=False):
|
||||
hightxt, lowtxt = "euro/s", "centavo/s"
|
||||
if old:
|
||||
hightxt, lowtxt = "peso/s", "peseta/s"
|
||||
result = self.to_splitnum(val, hightxt=hightxt, lowtxt=lowtxt,
|
||||
divisor=1, jointxt="y", longval=longval)
|
||||
def to_currency(self, val, currency='EUR', cents=True, seperator=' con',
|
||||
adjective=False):
|
||||
result = super(Num2Word_ES, self).to_currency(
|
||||
val, currency=currency, cents=cents, seperator=seperator,
|
||||
adjective=adjective)
|
||||
# Handle exception, in spanish is "un euro" and not "uno euro"
|
||||
return result.replace("uno", "un")
|
||||
|
||||
Reference in New Issue
Block a user