In Russia, Ukraine, Kazakhstan and Lithuania an invoice or a contract usually states the amount twice: in digits and in words. "1 521.40 RUB" becomes "Одна тысяча пятьсот двадцать один рубль 40 копеек".
I needed this in five languages and assumed it was a solved problem. Turning a number into words is solved, num2words does it well. What breaks is the currency name next to the number.
Three plural forms, not two
English has "1 dollar" and "2 dollars". Russian has three forms, and which one you get depends on the last digits:
| Amount | Russian | Ukrainian | Lithuanian |
|---|---|---|---|
| 1 | один рубль | одна гривня | vienas euras |
| 2 | два рубля | дві гривні | du eurai |
| 5 | пять рублей | п'ять гривень | penki eurai |
| 11 | одиннадцать рублей | одинадцять гривень | vienuolika eurų |
| 21 | двадцать один рубль | двадцять одна гривня | dvidešimt vienas euras |
The rule for Russian and Ukrainian:
def plural_index(n): if n % 10 == 1 and n % 100 != 11: return 0 # рубль if 2 <= n % 10 <= 4 and not 12 <= n % 100 <= 14: return 1 # рубля return 2 # рублей Lithuanian looks similar but splits differently: everything ending in 0 or in 11 to 19 takes the genitive plural ("dešimt eurų"), so a copy of the Russian rule gives wrong output for 20, 30, 100.
Gender changes the number itself
The currency also decides the form of "one" and "two". Hryvnia is feminine, so it is "одна гривня", "дві гривні". Euro in Ukrainian is neuter: "одне євро". Lithuanian does the same with "du eurai" but "dvi grivinos". And "тысяча" (thousand) is itself feminine in Russian, so 2 000 is "две тысячи" even when the currency is masculine.
Some currencies ignore all of this. Tenge and euro do not change in Russian at all ("пять тенге"), but the minor unit does ("пять тиынов").
French has its own traps
"Quatre-vingts euros" takes an s, "quatre-vingt-un euros" does not. "Deux cents euros" takes an s, "deux cent mille euros" does not. And a round million is a noun, so it is "un million d'euros", but "un million deux euros".
Who actually needs this
The online version of this converter on my site gets most of its Google impressions from Kazakhstan: 223 of 974. People search for things like "тенге прописью", which is exactly the case where the main unit does not decline and the minor one does.
How I checked it
- Plain number words in all five languages match num2words on 8 000 values: 0 to 3 000 plus 5 000 random numbers up to 10^14.
- The Rust port gives the same output as the Python version on 20 000 random amounts across all currencies, languages and formats. Zero mismatches.
Use it
pip install summa-propisyu from summa_propisyu import amount_in_words amount_in_words(22.02, "UAH", lang="uk") # 'Двадцять дві гривні 02 копійки' Rust: cargo add summa-propisyu, docs on docs.rs. Without code: сумма прописью online.
Eight currencies for now: EUR, USD, GBP, PLN, UAH, RUB, BYN, KZT.
One question for Lithuanian speakers: on an invoice, does "vienas tūkstantis eurų" look right to you, or would you write just "tūkstantis eurų"? I went with the first because that is what num2words and bank forms use, but I am not sure it is what people expect.
![UI Practice - Duolingo [1]](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8uawvr6a0e07ilktpkk7.png)

