Numbertext / libnumbertext

Number to number name and money text conversion libraries in C++, Java, JavaScript and Python & LibreOffice Calc Extension
BSD 3-Clause "New" or "Revised" License
67 stars 46 forks source link

1001000000 in Spanish #94

Closed atnbueno closed 1 year ago

atnbueno commented 2 years ago

1001000000 results in "mil uno millones" when it should be "mil un millones"

Same problem in a sequence: 31000000 → treinta y un millones [OK] 131000000 → ciento treinta y un millones [OK] 1031000000 → mil treinta y uno millones [ERROR: should be "un"] 10031000000 → diez mil treinta y uno millones [ERROR: should be "un"] 100031000000 → cien mil treinta y uno millones [ERROR: should be "un"] 1000031000000 → un billón treinta y un millones [OK]

An even more clear example ("veintiuno" is incorrect before a name): 21000000 = veintiún millones ✔ 121000000 = ciento veintiún millones ✔ 1021000000 = mil veintiuno millones ❌ 10021000000 = diez mil veintiuno millones ❌ 100021000000 = cien mil veintiuno millones ❌ 1000021000000 = un billón veintiún millones ✔

I've tried to find a fix with the online IDE without success

atnbueno commented 2 years ago

Workaround: in the meantime, I've added a .replace(/uno (\w+)ones/g, "un $1ón") to the final output

laszlonemeth commented 1 year ago

Hi,

The problem was solved in the previous patches of the v1.0.11 release, integrated with LibreOffice, too.

The result will be quite visible in LibreOffice 7.5, according to the new number and currency formats of the Calc Cell and Writer Field formatting dialog windows:

https://wiki.documentfoundation.org/ReleaseNotes/7.5#Default_.E2.80.9Cspell_out.E2.80.9D_number_and_currency_formats

Many thanks for your bug report!

Best regards, László