Gender displays incorrectly for Russian fractional units
In russian language letters at the end of the last digit depend on the gender, ex: один рубль but одна копейка.
$price = Price::toText(1.01, [['рублей', 'рубль', 'рубля'], ['копеек', 'копейка', 'копейки']], 'RU');
$this->assertEqualsIgnoringCase(
'один рубль одна копейка',
$price
);
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'один рубль одна копейка'
+'один рубль один копейка'
https://github.com/ivanovsaleksejs/NumToText/blob/master/src/NumToText_RU.php#L51
For russian language it should use $this->digits[$digit + 9] instead of $this->digits[$digit] for decimal part(копейка) if its ($digit == 1 || $digit == 2) && $this->step == 1.
I'm not sure how to check (inside the digitToWord method) if a digit comes from decimal part or the number. @ivanovsaleksejs I wonder if you have an idea how we can check it?
I think there's no way to check the gender which would work in all cases. And for russian there's also "middle" gender (одно песо). This means that there should be the way to tell the gender to the function. I will take a look and add a fix shortly.
Added genders parameter in https://github.com/ivanovsaleksejs/NumToText/commit/9f36245a028a222ca7cc3b3587ce9c764c487708. Please check if issue still exists.
Can you pleas confirm it's fixed?
Sorry for the late reply.
Unit test looks awesome, so I think it would would work as expected. But I will confirm within a few days, please do not close the issue, I'd like to reflect changes in README.md.
I've missed одно пессо, nice catch and thank you very much for the update! It makes my voice assistant which relies on NumToText much more natural.