Skip to content

The currency2text library converts currency to text in various languages

License

Notifications You must be signed in to change notification settings

aeroo/currency2text

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Currency to text converter

This is modular multilingual multi-currency amount to text converter written in Python. Module can be used to convert numbers to the text representation in various languages for various currencies. It's aim is to provide correct textual representation.

Supported sum: 0 ... 999999999999.99

Supported languages: (for more reference see languages folder) de_DE (German - Deutch), en_US (English), es_ES (Spanish - Español), lt_LT (Lithuanian - Lietuvių), lv_LV (Latvian - Laviešu), ru_RU (Russian - Русский) tr_TR (Turkish - Türkçe) uk_UA (Ukranian - Українська мова)

Supported currencies: (see particular language for reference) EUR, USD, TRY, MXN, LVL, LTL, UAH, RUB

Installation

from local folder: #> sudo ./setup.py install

directly from github: #> pip3 install git+https://github.com/aeroo/currency2text.git

Usage

from currency2text import currency_to_text, supported_language print(currency_to_text(23.45, 'EUR', 'lv_LV'))

divdesmit trīs eiro četrdesmit pieci centi

print(currency_to_text(23.45, 'EUR', 'en_US'))

twenty three euro fourty five cents

print(supported_language)

{'uk_UA': uk_UA, 'ru_RU': ru_RU, 'lt_LT': lt_LT, 'en_US': en_US, 'lv_LV': lv_LV, 'de_DE': de_DE, 'es_ES': es_ES, 'tr_TR': tr_TR}

suppl = supported_language[language_code] print(suppl.currency_to_text(23.45, 'USD'))

twenty three US dollars fourty five cents

print(supported_language.get('en_US').supported_currency)

{u'TRY': TRY, u'MXN': MXN, u'USD': USD, u'LVL': LVL, u'EUR': EUR, u'LTL': LTL}

Module Structure

Please inspect folder structure, in order to add new languages and currencies! Referrence languages are Latvian (lv_LV), English (en_US). Please consider implementing as much as possible other currencies for your language!

/currency2text (Main folder) /languages /lv_LV (Folder containing particular language) init.py (Main file that facilitates convertion of numbers to text) /currencies (Folder containing all currencies supported by the language) init.py (Do not edit this file!) lvl.py (Currency file, named by ISO code) usd.py (Another currecy) ...

About

The currency2text library converts currency to text in various languages

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages