Open JanWennrich opened 6 months ago
Hi JanWennrich,
Thanks for raising this issue. I'm happy to help you implement German language support for the Numera project.
I understand that you've tried to add German language support but encountered issues due to the complexities of the German language, such as using "vier" for 4 and "tausend" for 1000. I'm fully aware of the problem and I'm ready to help you resolve it.
Thanks for providing detailed information about the issue and the unit tests you've written. This will definitely help me understand the problem better.
Let's discuss this further and explore solutions to overcome the existing challenges. I suggest we take a closer look at the strategy pattern to separate the German number parsing logic from the main Numera class, making the code more scalable and readable.
If I have the time, I'll also try to investigate this issue further and see if I can come up with a solution. I'll make sure to keep you updated on my progress.
Thanks again for your guidance and for providing valuable insights into the issue. I'm looking forward to hearing your thoughts and suggestions.
Best regards
Hello there,
I tried adding support for the german language: https://github.com/JanWennrich/numera/tree/feat-german-language
But with german and it's quirks, numera does not work correctly.
Here are some of the problems I faced:
4000
is "four thousand" in english butviertausend
("vier" = 4, "tausend" = 1000) in german54
is "vierundfünzig" ("vier" = four, "fünzig" = fifty, "und" = and; "four and fifty")545156
is "fünfhundertfünfundvierzigtausendeinhundertsechsundfünfzig"1234
can be written as1.234
for better readability1
is "eins", but100
is "einhundert" ("ein-hundert") and1000000
is "eine Millionen"Feel free to check out the (failing) unit tests I wrote.
They describe most of the expected results for german inputs.
You may also check out https://zahlen-ausschreiben.de/ which converts a number to its string representation according to german spelling rules.
I tried changing the Numera implementation myself, but it was very hard with all those edge cases.
To ensure extensibility and readability, the logic for parsing german numbers should probably be in a separate class (e.g. strategy pattern).
The Numera main class could become a factory and decide which language class to use, based on the language string input.
I'd be happy to hear your thoughts about implementing the german language and maybe changing the architecture.
If it's fine for you, I may find some time to create a proper pull request. Or maybe you want to take it as a challenge?
Feel free to ask me any questions, especially about german and it's quirks.