mirror of
https://github.com/bblaz/num2words.git
synced 2025-12-06 06:42:25 +00:00
implement currency for HE
This commit is contained in:
committed by
Willem Van Onsem
parent
112e91c35a
commit
07ea1baca2
@@ -136,11 +136,13 @@ def n2w(n):
|
|||||||
return int2word(int(n))
|
return int2word(int(n))
|
||||||
|
|
||||||
|
|
||||||
def to_currency(n, currency='EUR', cents=True, separator=','):
|
|
||||||
raise NotImplementedError()
|
|
||||||
|
|
||||||
|
|
||||||
class Num2Word_HE(Num2Word_Base):
|
class Num2Word_HE(Num2Word_Base):
|
||||||
|
CURRENCY_FORMS = {
|
||||||
|
'NIS': (('שקל', 'שקלים'), ('אגורה', 'אגורות')),
|
||||||
|
'EUR': (('אירו', 'אירו'), ('סנט', 'סנט')),
|
||||||
|
'USD': (('דולר', 'דולרים'), ('סנט', 'סנט')),
|
||||||
|
}
|
||||||
|
|
||||||
def to_cardinal(self, number):
|
def to_cardinal(self, number):
|
||||||
return n2w(number)
|
return n2w(number)
|
||||||
|
|
||||||
@@ -150,6 +152,14 @@ class Num2Word_HE(Num2Word_Base):
|
|||||||
def pluralize(self, n, forms):
|
def pluralize(self, n, forms):
|
||||||
return pluralize(n, forms)
|
return pluralize(n, forms)
|
||||||
|
|
||||||
|
def to_currency(self, val, currency='NIS', cents=True, separator=' ו',
|
||||||
|
adjective=False):
|
||||||
|
result = super(Num2Word_HE, self).to_currency(
|
||||||
|
val, currency=currency, cents=cents, separator=separator,
|
||||||
|
adjective=adjective)
|
||||||
|
# In Hebrew the separator is along with the following word
|
||||||
|
return result.replace(" ו ", " ו")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
yo = Num2Word_HE()
|
yo = Num2Word_HE()
|
||||||
|
|||||||
Reference in New Issue
Block a user