Page 1 of 2

Antonio: Num2Word.prg

PostPosted: Mon Jun 05, 2017 3:20 pm
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"

Re: Antonio: Num2Word.prg

PostPosted: Tue Jun 06, 2017 12:05 am
by nageswaragunupudi
Thank you very much.
We implemented the changes.

Re: Antonio: Num2Word.prg

PostPosted: Tue Jun 06, 2017 10:00 am
by Silvio.Falconi
I saw there is not italian language can have the source on english

Re: Antonio: Num2Word.prg

PostPosted: Tue Jun 06, 2017 10:05 am
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"

Re: Antonio: Num2Word.prg

PostPosted: Tue Jun 06, 2017 1:35 pm
by nageswaragunupudi
We had Italian too:
This was the original translation:
Code: Select all  Expand view
     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.

Re: Antonio: Num2Word.prg

PostPosted: Tue Jun 06, 2017 1:36 pm
by nageswaragunupudi
We request other users of Spanish and Portuguese also to suggest correct translations.
Please see \fwh\source\function\num2words.prg

Re: Antonio: Num2Word.prg

PostPosted: Tue Jun 06, 2017 1:52 pm
by Silvio.Falconi
the italian language is wrong
Code: Select all  Expand view

 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"

Re: Antonio: Num2Word.prg

PostPosted: Tue Jun 06, 2017 2:10 pm
by nageswaragunupudi
Mr Silvio

I now adopted what you suggested.

Re: Antonio: Num2Word.prg

PostPosted: Tue Jun 06, 2017 2:12 pm
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"

Re: Antonio: Num2Word.prg

PostPosted: Tue Jun 06, 2017 2:20 pm
by nageswaragunupudi
Mr Vilian

Thank you. Adopted

Re: Antonio: Num2Word.prg

PostPosted: Tue Jun 06, 2017 2:24 pm
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 ?

Re: Antonio: Num2Word.prg

PostPosted: Tue Jun 06, 2017 3:25 pm
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  Expand view

   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  Expand view

Euros quatro mil cinco cento sessenta sete e  cents vinte três
Reals quatro mil cinco cento sessenta sete e cents vinte três
 

Re: Antonio: Num2Word.prg

PostPosted: Tue Jun 06, 2017 3:59 pm
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

Re: Antonio: Num2Word.prg

PostPosted: Tue Jun 06, 2017 5:14 pm
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.

Re: Antonio: Num2Word.prg

PostPosted: Tue Jun 06, 2017 5:27 pm
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