2015-02-11 8:29 GMT+01:00 Michele Locati <[email protected]>:

> 2015-02-11 1:40 GMT+01:00 Daiki Ueno <[email protected]>:
>
>> Michele Locati <[email protected]> writes:
>>
>> > I just finished a little tool that converts the plural rules from the
>> > CLDR format to the gettext format.
>>
>> Looks like a useful tool.  Perhaps msginit (plural-table.c) could use
>> the generated data.
>>
>>
What about a structure like this?

// In plural-table.h
struct plural_table_entry
{
  const char *lang;
  const char *language;
  const char *value;
  const char **cases;
  const char **examples;
};

// In plural-table.c
struct plural_table_entry plural_table[] = {
  {
    "af",
    "Afrikaans",
    "nplurals=2; plural=n != 1",
    {"one", "other"},
    {"1", "0, 2~16, 100, 1000, 10000, 100000, 1000000, ..."}
  },
  {
    "ak",
    "Akan",
    "nplurals=2; plural=n > 1",
    {"one", "other"},
    {"0, 1", "2~17, 100, 1000, 10000, 100000, 1000000, ..."}
  },
  {
    "am",
    "Amharic",
    "nplurals=2; plural=n > 1",
    {"one", "other"},
    {"0, 1", "2~17, 100, 1000, 10000, 100000, 1000000, ..."}
  },
  {
    "ar",
    "Arabic",
    "nplurals=6; plural=(n == 0) ? 0 : ((n == 1) ? 1 : ((n == 2) ? 2 : ((n
% 100 >= 3 && n % 100 <= 10) ? 3 : ((n % 100 >= 11 && n % 100 <= 99) ? 4 :
5))))",
    {"zero", "one", "two", "few", "many", "other"},
    {"0", "1", "2", "3~10, 103~110, 1003, ...", "11~26, 111, 1011, ...",
"100~102, 200~202, 300~302, 400~402, 500~502, 600, 1000, 10000, 100000,
1000000, ..."}
  },
  // ...
  {
    "zh",
    "Chinese",
    "nplurals=1; plural=0",
    {"other"},
    {"0~15, 100, 1000, 10000, 100000, 1000000, ..."}
  },
  {
    "zu",
    "Zulu",
    "nplurals=2; plural=n > 1",
    {"one", "other"},
    {"0, 1", "2~17, 100, 1000, 10000, 100000, 1000000, ..."}
  }
};

Reply via email to