Difference between revisions of "Talk:NUMBERTEXT/MONEYTEXT development"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Some languages need male/female option for number to text)
(Some fixes on Catalan definition)
Line 32: Line 32:
 
== Some fixes on Catalan definition ==
 
== Some fixes on Catalan definition ==
  
__numbertext__
+
__numbertext__  
 +
 +
^0 zero
 +
1$ u
 +
1 un
 +
2 dos
 +
3 tres
 +
4 quatre
 +
5 cinc
 +
6 sis
 +
7 set
 +
8 vuit
 +
9 nou
 +
10 deu
 +
11 onze
 +
12 dotze
 +
13 tretze
 +
14 catorze
 +
15 quinze
 +
16 setze
 +
17 disset
 +
1(\d) di$1
 +
20 vint
 +
2(\d) vint-i-$1
 +
30 trenta
 +
40 quaranta
 +
50 cinquanta
 +
60 seixanta
 +
70 setanta
 +
80 vuitanta
 +
90 noranta
 +
(\d)(\d) $(\10)-$2
 +
1(\d\d) cent $1
 +
(\d)(\d\d) $1-cents $2
 +
1(\d{3}) mil $1
 +
(\d{1,3})(\d{3}) $1 mil $2
 +
1(\d{6}) un milió $1
 +
(\d{1,6})(\d{6}) $1 milions $2
 +
1(\d{9}) mil milions $1
 +
1(\d{12}) un bilió $1
 +
(\d{1,6})(\d{12}) $1 bilions $2
 +
1(\d{18}) un trilió $1
 +
(\d{1,6})(\d{18}) $1 trilions $2
 +
1(\d{24}) un quadrilió $1
 +
(\d{1,6})(\d{24}) $1 quadrilions $2 
 +
 +
# negative number?
 +
 +
[-−](\d+) menys |$1
 +
 +
# decimals
 +
 +
"([-−]?\d+)[.,]" $1| coma
 +
"([-−]?\d+[.,]\d*)(\d)" $1| |$2
 +
 +
# currency
 +
 +
# unit/subunit singular/plural
 +
 +
us:([^,]*),([^,]*),([^,]*),([^,]*) \1
 +
up:([^,]*),([^,]*),([^,]*),([^,]*) \2
 +
ss:([^,]*),([^,]*),([^,]*),([^,]*) \3
 +
sp:([^,]*),([^,]*),([^,]*),([^,]*) \4
 +
CHF:(\D+) $(\1: franc suís, francs suís, cèntim, cèntims)
 +
EUR:(\D+) $(\1: euro, euros, cèntim, cèntims)
 +
GBP:(\D+) $(\1: lliura esterlina, lliures esterlines, penic, penics)
 +
JPY:(\D+) $(\1: ien, iens, sen, sen)
 +
USD:(\D+) $(\1: dòlar EUA, dòlar EUA, cent, cents)
 +
"([A-Z]{3}) ([-−]?1)([.,]00?)?" $2 $(\1:us)
 +
"([A-Z]{3}) ([-−]?\d+)([.,]00?)?" $2 $(\1:up)
 +
"(([A-Z]{3}) [-−]?\d+)[.,](01)" $1 amb $(1) $(\2:ss)
 +
"(([A-Z]{3}) [-−]?\d+)[.,](\d)" $1 amb $(\30) $(\2:sp)
 +
"(([A-Z]{3}) [-−]?\d+)[.,](\d\d)" $1 amb $3 $(\2:sp)
  
^0 zero
+
: Fixed in Numbertext 0.6. Many thanks for your help. [[User:Nemeth|Nemeth]] 22:16, 3 September 2009 (UTC)
 
+
1$ u
+
 
+
1 un
+
 
+
2 dos
+
 
+
3 tres
+
 
+
4 quatre
+
 
+
5 cinc
+
 
+
6 sis
+
 
+
7 set
+
 
+
8 vuit
+
 
+
9 nou
+
 
+
10 deu
+
 
+
11 onze
+
 
+
12 dotze
+
 
+
13 tretze
+
 
+
14 catorze
+
 
+
15 quinze
+
 
+
16 setze
+
 
+
17 disset
+
 
+
1(\d) di$1
+
 
+
20 vint
+
 
+
2(\d) vint-i-$1
+
 
+
30 trenta
+
 
+
40 quaranta
+
 
+
50 cinquanta
+
 
+
60 seixanta
+
 
+
70 setanta
+
 
+
80 vuitanta
+
 
+
90 noranta
+
 
+
(\d)(\d) $(\10)-$2
+
 
+
1(\d\d) cent $1
+
 
+
(\d)(\d\d) $1-cents $2
+
 
+
1(\d{3}) mil $1
+
 
+
(\d{1,3})(\d{3}) $1 mil $2
+
 
+
1(\d{6}) un milió $1
+
 
+
(\d{1,6})(\d{6}) $1 milions $2
+
 
+
1(\d{9}) mil milions $1
+
 
+
1(\d{12}) un bilió $1
+
 
+
(\d{1,6})(\d{12}) $1 bilions $2
+
 
+
1(\d{18}) un trilió $1
+
 
+
(\d{1,6})(\d{18}) $1 trilions $2
+
 
+
1(\d{24}) un quadrilió $1
+
 
+
(\d{1,6})(\d{24}) $1 quadrilions $2
+
 
+
 
+
# negative number?
+
 
+
[-−](\d+) menys |$1
+
 
+
# decimals
+
 
+
"([-−]?\d+)[.,]" $1| coma
+
 
+
"([-−]?\d+[.,]\d*)(\d)" $1| |$2
+
 
+
# currency
+
 
+
# unit/subunit singular/plural
+
 
+
us:([^,]*),([^,]*),([^,]*),([^,]*) \1
+
 
+
up:([^,]*),([^,]*),([^,]*),([^,]*) \2
+
 
+
ss:([^,]*),([^,]*),([^,]*),([^,]*) \3
+
 
+
sp:([^,]*),([^,]*),([^,]*),([^,]*) \4
+
 
+
CHF:(\D+) $(\1: franc suís, francs suís, cèntim, cèntims)
+
 
+
EUR:(\D+) $(\1: euro, euros, cèntim, cèntims)
+
 
+
GBP:(\D+) $(\1: lliura esterlina, lliures esterlines, penic, penics)
+
 
+
JPY:(\D+) $(\1: ien, iens, sen, sen)
+
 
+
USD:(\D+) $(\1: dòlar EUA, dòlar EUA, cent, cents)
+
 
+
"([A-Z]{3}) ([-−]?1)([.,]00?)?" $2 $(\1:us)
+
 
+
"([A-Z]{3}) ([-−]?\d+)([.,]00?)?" $2 $(\1:up)
+
 
+
"(([A-Z]{3}) [-−]?\d+)[.,](01)" $1 amb $(1) $(\2:ss)
+
 
+
"(([A-Z]{3}) [-−]?\d+)[.,](\d)" $1 amb $(\30) $(\2:sp)
+
 
+
"(([A-Z]{3}) [-−]?\d+)[.,](\d\d)" $1 amb $3 $(\2:sp)
+
  
 
== French numbering remarks ==
 
== French numbering remarks ==

Revision as of 22:16, 3 September 2009

Discussion page of NUMBERTEXT/MONEYTEXT development

Start a new section for a new theme, bug report or a language module (Soros program). See also NUMBERTEXT.org.

License requirements: Soros programs of NUMBERTEXT project are released under LGPL/BSD dual-license.

Some languages need male/female option for number to text

Hi, in Catalan de numbers 1 and 2 can be male or female, based on what's numered. Example: cotxe (car) is male and flor (flower) is female. So 1 cotxe (one car) is spelled "un cotxe" and 1 flor (one flower) is spelled "una flor". So, 1--> un (if male noun) and una (if female noun), 2 --> dos (if male noun) and dues (if female noun).

This male/female change also happens in numbers finished in 1 and 2 different that 11 and 12 (21, 22, 31, 32, ...) and also in hundreds and thousands.

Spanish also has this male/female, but only in numbers finished in 1. In Spanish 2 it's always spelled "dos".

Finally, this male/female isseu als is important for currency to text. Many currency are treated as male nouns: euro, dollar. But few currencis are "female": sterling pounds or the old spanish peseta. So, 1200 $ is spelled as "mil dos-cents dòllars", but 1200 PTA is spelled as "mil dues-centes pessetes".

I have fixed them by text converters. ca_ES uses manual arguments for the gender of the currency units and subunits, es_ES module uses automatic gender detection (feminine units end with "a" or "as"):
# masculine to feminine conversion of "un" after millions,
# if "as?$" matches currency name

f:(.*ill)(.*),(.*) \1$(f:\2,\3)		# don't modify un in millions
f:(.*un)([^a].*,|,)(.*as?) $(f:\1a\2\3)	# un libra -> una libra
f:(.*),(.*) \1 \2

"([A-Z]{3}) ([-−]?1)" $(f:|$2,$(\1:us))
"([A-Z]{3}) ([-−]?\d+0{6,})" $2 de $(\1:up)
"([A-Z]{3}) ([-−]?\d+)" $(f:|$2,$(\1:up))
Thanks for your report. Nemeth 22:12, 3 September 2009 (UTC)

Some fixes on Catalan definition

__numbertext__ 

^0 zero
1$ u
1 un
2 dos
3 tres
4 quatre
5 cinc
6 sis
7 set
8 vuit
9 nou
10 deu
11 onze
12 dotze
13 tretze
14 catorze
15 quinze
16 setze
17 disset
1(\d) di$1
20 vint
2(\d) vint-i-$1
30 trenta
40 quaranta
50 cinquanta
60 seixanta
70 setanta
80 vuitanta
90 noranta
(\d)(\d) $(\10)-$2
1(\d\d) cent $1
(\d)(\d\d) $1-cents $2
1(\d{3}) mil $1
(\d{1,3})(\d{3}) $1 mil $2
1(\d{6}) un milió $1
(\d{1,6})(\d{6}) $1 milions $2
1(\d{9}) mil milions $1
1(\d{12}) un bilió $1
(\d{1,6})(\d{12}) $1 bilions $2
1(\d{18}) un trilió $1
(\d{1,6})(\d{18}) $1 trilions $2
1(\d{24}) un quadrilió $1
(\d{1,6})(\d{24}) $1 quadrilions $2  

# negative number?

[-−](\d+) menys |$1

# decimals

"([-−]?\d+)[.,]" $1| coma
"([-−]?\d+[.,]\d*)(\d)" $1| |$2

# currency

# unit/subunit singular/plural

us:([^,]*),([^,]*),([^,]*),([^,]*) \1
up:([^,]*),([^,]*),([^,]*),([^,]*) \2
ss:([^,]*),([^,]*),([^,]*),([^,]*) \3
sp:([^,]*),([^,]*),([^,]*),([^,]*) \4
CHF:(\D+) $(\1: franc suís, francs suís, cèntim, cèntims)
EUR:(\D+) $(\1: euro, euros, cèntim, cèntims)
GBP:(\D+) $(\1: lliura esterlina, lliures esterlines, penic, penics)
JPY:(\D+) $(\1: ien, iens, sen, sen)
USD:(\D+) $(\1: dòlar EUA, dòlar EUA, cent, cents)
"([A-Z]{3}) ([-−]?1)([.,]00?)?" $2 $(\1:us)
"([A-Z]{3}) ([-−]?\d+)([.,]00?)?" $2 $(\1:up)
"(([A-Z]{3}) [-−]?\d+)[.,](01)" $1 amb $(1) $(\2:ss)
"(([A-Z]{3}) [-−]?\d+)[.,](\d)" $1 amb $(\30) $(\2:sp)
"(([A-Z]{3}) [-−]?\d+)[.,](\d\d)" $1 amb $3 $(\2:sp) 
Fixed in Numbertext 0.6. Many thanks for your help. Nemeth 22:16, 3 September 2009 (UTC)

French numbering remarks

Congratulations for this fantastic extension ! It was needed for many years !

I checked numbertext-0.5.oxt, which does not yet support fr-BE and fr-CH.

For your tests, the french web site Le Conjugueur is probably a reference.

Special cases

100 should be written : cent instead of : un cent (error only in NUMBERTEXT)

1000 should be written : mille instead of : un mille

Same for 137, 1284, etc.


1000000000 should be written : un milliard instead of : un milliarde

2000000000 should be written : deux milliards instead of : deux milliardes

etc

Decimals

NUMBERTEXT systematically writes the decimal separator as : "comma", this is incorrect.

fr-FR and fr-BE use the comma as separator. The term "comma" translates in french as "virgule"

fr-CH use a dot as separator. The term "dot" translates in french as "point"


In french we write (and say) decimals as if it were a number :

3,14 should be written : trois virgule quatorze instead of : trois virgule un quatre

3,1415 should be written : trois virgule mille quatre cent quinze

3,141592 should be written : trois virgule cent quarante et un mille cinq cent quatre-vingt-douze

3,1415926535 should be written : trois virgule un milliard quatre cent quinze millions neuf cent vingt-six mille cinq cent trente-cinq

NUMBERTEXT only : 5,000375 should be written : cinq virgule zéro zéro zéro trois cent soixante-quinze

MONEYTEXT

3,1 in Euros shoud be written : trois euros et dix centimes instead of : trois euros y dix centimes

Personal tools