CosNumberTranslate


Follow
0
Star
1
Details
Screenshots
Version history
Issues

What's new in this version

Linked application to Salutic Soluciones company

The aim of this function is to convert numbers into text. It allows a maximum number of 15 digits. 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 10^9 (millards) in English-speaking countries format.

NumberTranslate

Gitter

Convert number to text for Cache Object Script (Intersystems)

Overview

the aim of this function is to convert numbers into text. It allows a maximum number of 15 digits. 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 10^9 (millards) in English-speaking countries format. See the following link Billion Wikipedia

Example

USER> w ##class(NumberTranslate.NumberTranslate).GetText(123,.tSc)
one hundred and twenty-three
USER> w ##class(NumberTranslate.NumberTranslate).GetText(123,.tSc,"es")
ciento veintitres
USER> w ##class(NumberTranslate.NumberTranslate).GetText(123,.tSc,"ca")
cent vint-i-tres
USER> w ##class(NumberTranslate.NumberTranslate).GetText(123,.tSc,"ru")
Сто двадцать три
USER> w ##class(NumberTranslate.NumberTranslate).GetText(1000000000,.tSc,"en",1)
one billion
USER> w ##class(NumberTranslate.NumberTranslate).GetText(1000000000,.tSc,"en",0)
one thousand millions
USER> w ##class(NumberTranslate.NumberTranslate).GetText(1000000000000,.tSc,"en",1)
one trillion
USER> w ##class(NumberTranslate.NumberTranslate).GetText(1000000000000,.tSc,"en",0)
one billion

In case of error, you can catch the error with the status variable

USER> set text=##class(NumberTranslate.NumberTranslate).GetText(123,.tSc,"fr") 
USER> if ('tSc) { w $System.Status.GetErrorText(tSc) } else { w text }        
ERROR #420: Lang fr not exists

Version history

2019-03-04 Version 1.1.2 - Minor issue fixed

2018-08-08 Version 1.1.1 - Fixed issue about "hundred"

2018-08-07 Version 1.1 - Russian translate

2018-06-29 Version 1.0 - Initial version

Category
Tools
Works with
Caché
Tags
Info
Version
1.1.3
Last updated
2019-04-15
Repository
Open
Documentation
Open
License
Link