[Top][All Lists]

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

Re: [bug-gettext] Plural rule definitions

From: Michele Locati
Subject: Re: [bug-gettext] Plural rule definitions
Date: Fri, 22 May 2015 11:25:29 +0200

2015-05-22 9:55 GMT+02:00 Daiki Ueno <address@hidden>:
Michele Locati <address@hidden> writes:

Yes, my intent was to make the output resemble the current style of
plural-table.c as much as possible, to make the initial diff smaller.
BTW, for samples, I plan to add a separate array, say
plural_sample_table to avoid confusion.

 It's a good compromise ;)

I hit on an algorithm:

- From all rules, find the largest modulo M (here 100)

- Prepare a bit vector with M elements and initialize it with zeros

- Loop over the rules
  - For each value in the range [1, M], apply a rule, and flip the
    corresponding bit if it evaluates true
  - Stop if all bits are set

Maybe we can also omit rules which don't change the vector, but it seems
to work with the Russian case so far:

I started from the assumption that languages won't change that much, but your approach is a much better solution IMHO.
Did you tested if for the other special case (pl - Polish) too?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]