Summary:ASTERISK-07332: [patch][post 1.4] NUMERAL function - numeral selection for Russian and Ukrainian language
Reporter:Oleg Oleg (theedge)Labels:
Date Opened:2006-07-13 04:00:56Date Closed:2011-06-07 14:02:46
Versions:Frequency of
Environment:Attachments:( 0) patch.func_numeral.c
Description:Helper function for correct numeral selection for russian language, i.e.:
1 rubl
3 rublya
7 rubley
So a call to the function like NUMERAL(158,hrivna,hrivni,hriven) returns 'hriven'.
Tested in *


exten => 51,n,SayNumber(${COUNT},f)
exten => 51,n,Playback(cash/${NUMERAL(${COUNT},rubl,rublya,rubley)})
Comments:By: Serge Vecher (serge-v) 2006-07-13 08:45:03

Quick comments:
1. Please get a disclaimer on file (the edhttp://bugs.digium.com/main_page.php) and confirm with a note when done.
2. This is actually a new feature, so the patch needs to be tested against trunk, as this is where it maybe merged if all conditions are satisfied.

By: Oleg Oleg (theedge) 2006-07-25 02:40:19

1. I'll try to send a disclaimer ASAP. Will it be ok if I put my name and signature to http://www.digium.com/disclaim.changes
2. I couldn't delete the old attach, so I upload a patch against trunk 38041

By: Serge Vecher (serge-v) 2006-07-25 08:09:31

1. yes

By: Tilghman Lesher (tilghman) 2006-07-25 12:16:46

Could you provide a better description as to what this function is doing?  I'm not at all clear on this, nor why it is needed.

By: Oleg Oleg (theedge) 2006-07-26 01:17:04

Ok, in English it's simple to spell cardinal numeral, in Russian and Ukrainian language it's a bit trickier, we say:
odin rubl (1)
p'yat rubley (5)
dvesty dva rublya (202)
So we need to know a correct cardinal numeral for certain number, so it spells gramatically correct. That's it in a nutshell.

By: Tilghman Lesher (tilghman) 2006-07-26 08:35:48

I'm asking Paul Cadach to take a look at this, as a native speaker.

By: Paul Cadach (pcadach) 2006-08-31 23:50:46

Formatting review isn't passed, and negative values isn't handled. Better is to use additional variables for number % 100 and eliminate usage of array with 3 possible values (better is to do sequence of if()s).

By: jmls (jmls) 2006-11-01 06:28:29.000-0600

theedge, would you respond to the comments made by PCadach ? Thanks.

By: Tilghman Lesher (tilghman) 2007-01-09 08:26:38.000-0600

No response from reporter.