Antonio: Num2Word.prg

User avatar
byte-one
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria
Contact:

Antonio: Num2Word.prg

Post by byte-one »

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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Antonio: Num2Word.prg

Post by nageswaragunupudi »

Thank you very much.
We implemented the changes.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Antonio: Num2Word.prg

Post by Silvio.Falconi »

I saw there is not italian language can have the source on english
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Antonio: Num2Word.prg

Post by Silvio.Falconi »

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"
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Antonio: Num2Word.prg

Post by nageswaragunupudi »

We had Italian too:
This was the original translation:

Code: Select all

      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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Antonio: Num2Word.prg

Post by nageswaragunupudi »

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
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Antonio: Num2Word.prg

Post by Silvio.Falconi »

the italian language is wrong

Code: Select all

 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"
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Antonio: Num2Word.prg

Post by nageswaragunupudi »

Mr Silvio

I now adopted what you suggested.
Regards

G. N. Rao.
Hyderabad, India
User avatar
vilian
Posts: 795
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Re: Antonio: Num2Word.prg

Post by vilian »

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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Antonio: Num2Word.prg

Post by nageswaragunupudi »

Mr Vilian

Thank you. Adopted
Regards

G. N. Rao.
Hyderabad, India
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Antonio: Num2Word.prg

Post by Silvio.Falconi »

nageswaragunupudi wrote:Mr Silvio

I now adopted what you suggested.

thanks to try the function can you write wich are c1 and c2 parameters ?
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Antonio: Num2Word.prg

Post by nageswaragunupudi »

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: Select all

   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: Select all

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
User avatar
vilian
Posts: 795
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Re: Antonio: Num2Word.prg

Post by vilian »

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
User avatar
miragerr
Posts: 140
Joined: Tue Oct 11, 2005 2:36 am
Location: Brasil

Re: Antonio: Num2Word.prg

Post by miragerr »

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
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Antonio: Num2Word.prg

Post by Silvio.Falconi »

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
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Post Reply