an assorted collection of randomness and non-essential remarks
Have at least one original repos where PHP is the dominant language The walrus is no stranger to variety. Use at least 4 different languages throughout all your repos Fork and commit to someone's open source project in need Have a project valued enough to be forked by someone else Have at least three original repos where Ruby is the dominant language Have at least one original repo where Ruby is the dominant language Have at least one original repo where some form of shell script is the dominant language
Endorse tarakanbg on Coderwall Powered by Obtvse

Slovom - a Ruby library for verbalizing currency

Last night I released a new ruby gem (slovom).

It converts decimal currency numbers into text in Bulgarian language, which can be useful in financial applications, accounting documents, and all other instances requiring currency verbalization. It handles the specifics of verbally presenting numbers and prices in Bulgarian, including grammatical irregularities, differences due to gender, singularity and plurality and the logic of using or omitting the "and" conjunction from the resulting string.

It's extracted from a pawnbroker/pawnshop rails application which I'm currently working on, called Lombard, to be released as a service in the coming months.

Example usage:

product1.price.to_s => "23.00"
product1.price.slovom => "двадесет и три лева"

product2.price.to_s => "1563.78"
product2.price.slovom => "хиляда петстотин шестдесет и три лева и седемдесет и осем стотинки"

product3.price.to_s => "0.75"
product3.price.slovom => "седемдесет и пет стотинки"

"76.03".to_d.slovom => "седемдесет и шест лева и три стотинки"

It's a bit surprising to see some 50 downloads of the gem in less than a day, hopefully other Bulgarian ruby developers will find it useful.

Here's the github link for convenience.

Back to Blog