Metadata-Version: 2.4
Name: summa-propisyu
Version: 0.1.0
Summary: Amounts in words for invoices and contracts: Russian, Ukrainian, Lithuanian, English, French. Сумма прописью.
Project-URL: Homepage, https://www.utilixi.com
Project-URL: Online converter, https://www.utilixi.com/ru/converter/number-to-words
Author: Alexei Kolev
License: MIT
License-File: LICENSE
Keywords: amount in words,hryvnia,invoice,num2words,number to words,suma žodžiais,tenge,сумма прописью
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Natural Language :: French
Classifier: Natural Language :: Lithuanian
Classifier: Natural Language :: Russian
Classifier: Natural Language :: Ukrainian
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Office/Business :: Financial :: Accounting
Classifier: Topic :: Text Processing :: Linguistic
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# summa-propisyu

Money amounts in words for invoices, contracts and receipts, in five languages:
Russian, Ukrainian, Lithuanian, English and French. No dependencies.

```bash
pip install summa-propisyu
```

```python
from summa_propisyu import amount_in_words

amount_in_words(1521.40, "RUB", lang="ru")
# 'Одна тысяча пятьсот двадцать один рубль 40 копеек'

amount_in_words(22.02, "UAH", lang="uk")
# 'Двадцять дві гривні 02 копійки'

amount_in_words(21.21, "KZT", lang="ru")
# 'Двадцать один тенге 21 тиын'

amount_in_words(12.11, "EUR", lang="lt")
# 'Dvylika eurų 11 centų'

amount_in_words(1000000, "EUR", lang="fr")
# "Un million d'euros et 00 centimes"
```

## Why another one

Spelling out a number is the easy part. The hard part in an invoice is the
currency name next to it, because it has to agree with the number:

| Amount | Russian | Ukrainian | Lithuanian |
|---|---|---|---|
| 1 | один рубль, одна гривна | одна гривня, одне євро | vienas euras, viena grivina |
| 2 | два рубля, две гривны | дві гривні, два євро | du eurai, dvi grivinos |
| 5 | пять рублей, пять гривен | п'ять гривень | penki eurai |
| 11 | одиннадцать рублей | одинадцять гривень | vienuolika eurų |
| 21 | двадцать один рубль | двадцять одна гривня | dvidešimt vienas euras |

Gender changes the number itself (один / одна, du / dvi), and there are
three plural forms, not two. Tenge and euro do not change in Russian at all.
French needs "un million **d'**euros" but "un million deux **euros**", and
"quatre-vingts euros" but "quatre-vingt-un euros". All of this is handled.

## Currencies

`EUR`, `USD`, `GBP`, `PLN`, `UAH`, `RUB`, `BYN`, `KZT` in every language.

## Options

```python
amount_in_words(amount, currency="RUB", lang="ru",
                minor="digits",    # "digits": 40 копеек, "words": сорок копеек, "none": whole units only
                capitalize=True)   # first letter in upper case
```

`amount` can be `int`, `float`, `str` or `Decimal`. It is rounded half up to
two decimals, so `"99.995"` becomes 100.00.

Numbers without currency:

```python
from summa_propisyu import number_in_words

number_in_words(2, "ru", gender="f")   # 'две'
number_in_words(2000, "uk")            # 'дві тисячі'
number_in_words(91, "fr")              # 'quatre-vingt-onze'
```

Range: up to 999 999 999 999 999 in both directions.

## Checked against num2words

Plain number words in all five languages match
[num2words](https://pypi.org/project/num2words/) on 8 000 values (0 to 3 000
and 5 000 random numbers up to 10^14). Lithuanian uses the document style
"vienas šimtas", "vienas tūkstantis", as num2words does.

## Online version

An online converter with the same languages and currencies is at
[utilixi.com](https://www.utilixi.com):

| Language | Converter |
|---|---|
| Русский | [Сумма прописью онлайн](https://www.utilixi.com/ru/converter/number-to-words) |
| Українська | [Сума прописом онлайн](https://www.utilixi.com/uk/converter/number-to-words) |
| Lietuvių | [Suma žodžiais](https://www.utilixi.com/lt/converter/number-to-words) |
| English | [Number to words](https://www.utilixi.com/en/converter/number-to-words) |
| Français | [Nombre en lettres](https://www.utilixi.com/fr/converter/number-to-words) |

## License

MIT
