plurals in glibc-2.2 - please help in collecting rules



Hallo everybody,

I want to try to collect plural rules for misc langauges to support more
info in next release of glibc-2.2.

Plural rule is expression of n (non-negative integer) returning plural number.

I am adding simple and stupid test program, which includes some numbers,
most problematic in Slavic languages.

Simple examples:

sh plural.sh "n != 1" dog dogs
sh plural.sh "n%100/10==1 ? 2 : n%10==1 ? 0 : (n+9)%10>3 ? 2 : 1" pes psi psu


Example of reply to this mail:
---- read here ----
Language family:
Slavic
Language:
Czech
Rule:
nplurals=3; plural=n%100/10==1 ? 2 : n%10==1 ? 0 : (n+9)%10>3 ? 2 : 1
Note:
(n+9)%10>3 is abbreviation of (n%10>4) || (n%10 <1) and works also for 0.
---- cut here ----
Language family:

Language:

Rule:

Note:

---- cut here ----


glibc-2.2 already collected these rules (please verify and keep mail if it's buggy):

nplurals=1; plural=0
- Finno-Ugric family
Hungarian
- Asian family
Japanese
- Turkic/Altaic family
Turkish

nplurals=2; plural=n != 1
- Germanic family
Danish, Dutch, English, German, Norwegian, Swedish
- Finno-Ugric family
Finnish
- Latin/Greek family
Greek
- Semitic family
Hebrew
- Romance family
Italian, Spanish
- Artificial
Esperanto

nplurals=2; plural=n>1
- Romanic family
French

nplurals=3; plural=n==1 ? 0 : n==2 ? 1 : 2
- Celtic
Gaeilge

nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 ? 1 : 2
- Slavic family
Russian
(This rule is buggy and incomplete!!!)

nplurals=3; plural=n==1 ? 0 : \
  n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2
- Slavic family
Polish

nplurals=4; plural=n==1 ? 0 : n%10==2 ? 1 : n%10==3 || n%10==4 ? 2 : 3
- Slavic family
Slovenian


And I have collected following extra rule (please also check and keep mail if it's buggy):

nplurals=3; plural=n%100/10==1 ? 2 : n%10==1 ? 0 : (n+9)%10>3 ? 2 : 1
- Slavic family
Czech, Russian, Slovak


More info: manual to GNU libc-2.2 nad later, file message.texi.

-- 
Stanislav Brabec

plural.sh

#include <stdlib.h>
#include <stdio.h>

main(int argc, char **argv)
{
int n, plural;
n=atoi(argv[1]);
plural = @@RULE@@ ;
printf("%d %s\n", n, argv[plural+2]);
}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]