savoirfairelinux / num2words

Modules to convert numbers to words. 42 --> forty-two
GNU Lesser General Public License v2.1
814 stars 488 forks source link

currency without part cents #190

Open neotrons opened 6 years ago

neotrons commented 6 years ago

Expected Behaviour

In my country when we write the value of the currency for the invoices, the cents part is not used and it is written like this:

for example:

55.45 ==> fifty-five and 45/100 dollars

Is this form implemented? If I implement, what is the best way to do it, it is possible to use the parameter cents = False to write it in the indicated way or I must use another parameter so that there is no confusion with other languages

shulcsm commented 6 years ago

If that is the correct form for your language/locale and you can point out reference where it's documented just implement it with cents=False since that flag is supposed to indicate whether cent part is spelled out. If you are going with Num2Word_Base i suggest refactoring this https://github.com/savoirfairelinux/num2words/blob/master/num2words/base.py#L294 like

cents_str = self._cents_verbose(right, currency) \
    if cents else  self._cents_plain(right, currency)  # Not sure about the name

So it's easily overloaded in your implementation

shulcsm commented 6 years ago

I've implemented _cents_terse in #194 that you would overload

mrodriguezg1991 commented 2 years ago

@neotrons Hi, can we close this issue ??