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

[th] Fix issue with currency with 1 digit decimal #65

Closed tyindeepit closed 4 years ago

tyindeepit commented 4 years ago

Fix issue with currency with 1 digit decimal so THB1.5 should be written as "หนึ่งบาทห้าสิบสตางค์" instead of "หนึ่งบาทห้าสตางค์"

Also fix the handling of digit 1 in decimal so that the if 1 is the last digit, it should be written as "เอ็ด". This is the same issue as 6b5fc3b so the same fix is used here.

laszlonemeth commented 4 years ago

Dear Contributor! Could you give me some reference about the correct spelling of THB 101, 202...? According to https://bz.apache.org/ooo/show_bug.cgi?id=83490, this BAHTTEXT-like spelling is wrong, or less good, than the recent one.

tyindeepit commented 4 years ago

I can't read the Thai in the bug report from the mentioned link. Seems to be encoding issue.

Is Wikipedia good enough? I couldn't find any official reference in English.

laszlonemeth commented 4 years ago

It's enough for me, if you are a Thai native speaker or language expert. I've made the recent conversion based on that OpenOffice.org issue, see https://github.com/Numbertext/libnumbertext/blob/master/test/thaicheck.ods, i.e. 101 is หนึ่งร้อยเอ็ด, and THB 101 is หนึ่งร้อยเอ็ดบาทถ้วน, and not หนึ่งร้อยหนึ่งบาทถ้วน, as in BAHTTEXT. Numbertext tries to follow the more formal written language, than the simplifications for pronunciation. If both forms are correct, we can add an extra function to support the other one, too.

tyindeepit commented 4 years ago

I'm a Thai native speaker. I found this FAQ from Royal Society of Thailand website stating that 101 is formally and exclusively หนึ่งร้อยเอ็ด (sorry, the website is in Thai.) They are responsible for planning and regulation or Thai Language who also published the Royal Thai General System of Transcription, the official system of rendering Thai words with Latin alphabet. So I'd say this is as formal and correct as it can be.

laszlonemeth commented 4 years ago

Many thanks for your help! I am going to update also the LibreOffice Numbertext integration with your fixes, too.

tyindeepit commented 4 years ago

Glad to be of help!