Translate a number to text
Hi all,
I'm pleased to announce this personal project to convert a number to text, in spanish, english, catalan and russian.
the aim of this function is to convert numbers into text. It allows a maximum number of 15 digits.
Overview
The translation is done in several languages. The allowed languages are
- es: Spanish
- en: English
- ca: Catalan
- ru: Russian
The function also allows to treat the numbers of 109 (milliards) in English-speaking countries format. See the following link Billion Wikipedia
w ##class(NumberTranslate.NumberTranslate).GetText(123,.tSc) one hundred and twenty-three w ##class(NumberTranslate.NumberTranslate).GetText(123,.tSc,"es") ciento veintitres w ##class(NumberTranslate.NumberTranslate).GetText(123,.tSc,"ca") cent vint-i-tres w ##class(NumberTranslate.NumberTranslate).GetText(123,.tSc,"ru") Сто двадцать три w ##class(NumberTranslate.NumberTranslate).GetText(1000000000,.tSc,"en",1) one billion w ##class(NumberTranslate.NumberTranslate).GetText(1000000000,.tSc,"es",0) mil millones
Please, have a look the project in the following link:
https://openexchange.intersystems.com/index.html#!/package/CosNumberTranslate
How to install
Open link last Version 1.1.2 CosNumberTranslation_v1.1.2.xml
Right click and select "Save as..."
Download the file .xml
Load from terminal in your namespace (i.e. USER)
USER> do $System.OBJ.Load("c:\temp\CosNumberTranslation_v1.1.2.xml","cs")
check a number
USER> w ##class(NumberTranslate.NumberTranslate).GetText(123,.tSc) one hundred and twenty-three
I hope it is useful for your development.
Best regards,
Francisco López