allegro / tradukisto

A Java i18n library created to convert numbers to their word representations.
Apache License 2.0
204 stars 92 forks source link

NumberToWordsConverter gives different result for different languages #154

Open giangianoulas opened 9 months ago

giangianoulas commented 9 months ago

Hi

If I do something like this

NumberToWordsConverter conv = new NumberToWordsConverter(Container.englishContainer().getIntegerConverter(), 
new EnglishValues().pluralForms());
return conv.asWords(3750); //== > The result will be "three thousand seven hunder..." this is correct

But if i do this If i i do something like this

NumberToWordsConverter conv = new NumberToWordsConverter(Container.czechContainer().getIntegerConverter(), 
new CzechValues().pluralForms());
return conv.asWords(3750); //== > The result will be "tri milliony sedm .... this is wrong, a whole order of magnitude wrong

I found the problem to be that in CzechValues::pluralForms

//No default entry exists
return Arrays.asList(new CzechPluralForms("tisíc", "tisíce", "tisíc", GenderType...);

//In contrast one exist for English
return Arrays.asList(new EnglishPluralForms(""), new EnglishPluralForms("thousand"),

Same applies error for German and other languages

giangianoulas commented 9 months ago

Actually it seems i miss used the code :) Closing it, please reject the PR