FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Antonio: Num2Word.prg
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Antonio: Num2Word.prg
Posted: Mon Jun 05, 2017 03:20 PM

Antonio, for german you should make this definition:

case nLang == 5 // German
aNums := { "ein", "zwei", "drei", "vier", "fünf", "sechs", "sieben", "acht", "neun", "zehn", ;
"elf", "zwölf", "dreizehn", "vierzehn", "fünfzehn", "sechzehn", "siebzehn", "achtzehn", "neunzehn ", "zwanzig" }
aTens := { "zehn", "zwanzig", "dreißig", "vierzig", "fünfzig", "sechzig", "siebzig", "achtzig", "neunzig" }
aUnits := { "hundert", "tausend", "millionen", "milliarden" }
cAnd := " und"

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Antonio: Num2Word.prg
Posted: Tue Jun 06, 2017 12:05 AM

Thank you very much.
We implemented the changes.

Regards



G. N. Rao.

Hyderabad, India
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Antonio: Num2Word.prg
Posted: Tue Jun 06, 2017 10:00 AM

I saw there is not italian language can have the source on english

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Antonio: Num2Word.prg
Posted: Tue Jun 06, 2017 10:05 AM

case nLang == 6 // Italian
aNums := { "uno", "due", "tre", "quattro", "cinque", "sei", "sette", "otto", "nove", "dieci", ;
"undici", "dodici", "tredici", "quattordici", "quindici", "sedici", "diciasette", "diciotto", "diciannove ", "venti" }
aTens := { "dieci", "venti", "trenta", "quaranta", "cinquanta", "sessanta", "settanta", "ottanta", "novanta" }
aUnits := { "cento", "mille", "millione", "milliardo" }
cAnd := " e"

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Antonio: Num2Word.prg
Posted: Tue Jun 06, 2017 01:35 PM
We had Italian too:
This was the original translation:
Code (fw): Select all Collapse
      aNums    := { "One", "due", "tre", "quattro", "cinque", "sei", "sette", "otto", "nove", "th", ;
                    "Undici", "dodici", "tredici", "quattordici", "quindici", "sedici", "diciassette", "diciotto", "diciannove", "venti" }
      aTens    := { "Th", "venti", "trenta", "quaranta", "cinquanta", "sessanta", "settanta", "ottanta", "novanta" }
      aUnits   := { "Cento", "mille", "milioni", "miliardi" }
      cAnd     := " e"

Now I changed as advised by you.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Antonio: Num2Word.prg
Posted: Tue Jun 06, 2017 01:36 PM

We request other users of Spanish and Portuguese also to suggest correct translations.
Please see \fwh\source\function\num2words.prg

Regards



G. N. Rao.

Hyderabad, India
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Antonio: Num2Word.prg
Posted: Tue Jun 06, 2017 01:52 PM
the italian language is wrong
Code (fw): Select all Collapse
 aNums    := { "One", "due", "tre", "quattro", "cinque", "sei", "sette", "otto", "nove", "th", ;
                    "Undici", "dodici", "tredici", "quattordici", "quindici", "sedici", "diciassette", "diciotto", "diciannove", "venti" }
      aTens    := { "Th", "venti", "trenta", "quaranta", "cinquanta", "sessanta", "settanta", "ottanta", "novanta" }
      aUnits   := { "Cento", "mille", "milioni", "miliardi" }
      cAnd     := " e"


this is the right

aNums := { "uno", "due", "tre", "quattro", "cinque", "sei", "sette", "otto", "nove", "dieci", ;
"undici", "dodici", "tredici", "quattordici", "quindici", "sedici", "diciasette", "diciotto", "diciannove ", "venti" }
aTens := { "dieci", "venti", "trenta", "quaranta", "cinquanta", "sessanta", "settanta", "ottanta", "novanta" }
aUnits := { "cento", "mille", "millione", "milliardo" }
cAnd := " e"
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Antonio: Num2Word.prg
Posted: Tue Jun 06, 2017 02:10 PM

Mr Silvio

I now adopted what you suggested.

Regards



G. N. Rao.

Hyderabad, India
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Antonio: Num2Word.prg
Posted: Tue Jun 06, 2017 02:12 PM

In portuguese:

aNums := { "um", "dois", "três", "quatro", "cinco", "seis", "sete", "oito", "nove", "dez", ;
"onze", "doze", "treze", "quatorze", "quinze", "dezesseis", "dezessete", "dezoito", "dezenove", "vinte" }
aTens := { "dez", "vinte", "trinta", "quarenta", "cinquenta", "sessenta", "setenta", "oitenta", "noventa" }
aUnits := { "cento", "mil", "milhão", "bilhão" }
cAnd := " e"

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Antonio: Num2Word.prg
Posted: Tue Jun 06, 2017 02:20 PM

Mr Vilian

Thank you. Adopted

Regards



G. N. Rao.

Hyderabad, India
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Antonio: Num2Word.prg
Posted: Tue Jun 06, 2017 02:24 PM
nageswaragunupudi wrote:Mr Silvio

I now adopted what you suggested.



thanks to try the function can you write wich are c1 and c2 parameters ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Antonio: Num2Word.prg
Posted: Tue Jun 06, 2017 03:25 PM
The function uses the currency name corresponding to the region set in
FWNumFormat( cRegion, [lThousandSeparator] )

cRegion can be 'A' for America (general format), 'B', for Britan, 'E' for Europe and 'I' for India. This setting decides the default numeric format:
'A' and 'B' : 999,999,999.99
'E' : 999.999.999,99
'I' : 99,99,99,999.99

function NUMPICT( 9, 2 ) --> picture depending on the country code.

It is desirable to depend on FWNumFormat() and NumPict() rather than hard-coding the picture clauses. This enables to change the numeric format globally and on the fly for applications that need to run globally.

The function selects currency name as "Dollar", "Pound", "Euro", "Rupee" on the basis of the region 'A', 'B', 'E' or 'I'.

When a different currency name is required, parameters c1 and c2 can be used for currency name and cents name.

Example:
Code (fw): Select all Collapse
   FWNumFormat( "E", .t. )  // European format
   FW_N2WSETUP( 4 ) // Portuguese
   ? FW_NUMTOWORDS( 4567.23 )
   ? FW_NUMTOWORDS( 4567.23, "Real", "cents" ) // The names will be used for all subsequent calls.


Result:
Code (fw): Select all Collapse
Euros quatro mil cinco cento sessenta sete e  cents vinte três
Reals quatro mil cinco cento sessenta sete e cents vinte três
Regards



G. N. Rao.

Hyderabad, India
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Antonio: Num2Word.prg
Posted: Tue Jun 06, 2017 03:59 PM
Mr Rao,

This result in portuguese is wrong:
Reals quatro mil cinco cento sessenta sete e cents vinte três


For this value(4567,23), the right result should be:

Quatro mil quinhentos e sessenta sete reais e vinte três centavos
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 140
Joined: Tue Oct 11, 2005 02:36 AM
Re: Antonio: Num2Word.prg
Posted: Tue Jun 06, 2017 05:14 PM

Ola... Boa tarde

Vilian, creio que esteja faltando uma variável do tipo

------------------100-------200------------300----------400------------500-------------600-------------700------------800---------900
aCentenas := { "Cem", "Duzentos","Trezentos","Quatrocentos","Quinhentos","Seiscentos","Setecentos","Oitocentos","Novecentos"}

Creio que seja isto.

Espero ter ajudado.

Jackson Douglas C. Brito

Boa Vista - RR - Brasil

FWH 12.09 Last Build

xHarbour Free

UESTUDIO

SQLRDD
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Antonio: Num2Word.prg
Posted: Tue Jun 06, 2017 05:27 PM
Nages,
I Try with
FWNumFormat( "E", .t. ) // European format
FW_N2WSETUP( 6 ) // Italian
? FW_NUMTOWORDS( 4567.23 )
? FW_NUMTOWORDS( 4567.23, "Euro", "centesimi" )

give me :
Euros quattro mille cinque Cento sessanta sette e cents vent tre

but this is wrong because

Quattromilacinquecentosessantasette/23

If the banck check is 500 euros, it is necessary to write: cinquecento/00.

If it is 500.50 euros, it is necessary to write: cinquecento/50

In case of 4567.23 In Italy I write

Euro QuattroMilaCinqueCentoSessantaSette/23

then you can ask also to Enrico Maria Giordano or another Italian friend

for try a test you can go to internet at https://www.blia.it/cifralettere/ and insert the number you want
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com