3

So I want to use a different plural rule than what is in the CLDR. I'm using ICU through PHP intl extension, and say I have something like this:

$msg = new MessageFormatter('ar',
                '{0,plural,  zero {zero-ar}' .
                'one {one-ar}' .
                'two {two-ar}' .
                'few {{0,number} few-ar}' .
                'many {{0,number} many-ar}' .
                'other{{0,number} other-ar} }.');

I'm not happy with the built in plural rule for one of the categories and would like to change it, is that possible? And no it's not just fixed intervals, so can't use choices.

hippietrail
  • 15,848
  • 18
  • 99
  • 158
Basel Shishani
  • 7,735
  • 6
  • 50
  • 67
  • may I ask what you're not happy with, specifically? (Just to understand) http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#ar – Steven R. Loomis Nov 09 '11 at 18:34
  • V. brief: In Arabic, each noun has singular, dual, plural forms, eg tree: shajara=tree-1 shajaratan=tree-2 ashjar=trees. For the case X100+1,+2, eg (102 trees) the traditional style is to use singular or dual forms rather than count subject: so (100 and tree-1, 100 and tree-2) instead of (102 tree-x-form). Now the 2nd style is acceptable and is used to avoid having special cases and usability issues with 1st style. However, it's fringe and correct tree-x-form is debatable - the CLDR has got it wrong on this case - there is a discussion here (http://wiki.arabeyes.org/Plural_Forms) (link down?). – Basel Shishani Nov 11 '11 at 04:36
  • In every comment I run out of space to thank you:)- really thanks fro your helpful answers. – Basel Shishani Nov 11 '11 at 04:41
  • glad to help. but, http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#ar looks the same as the "6 forms" given on the arabeyes page. The discussion part of arabeyes only seems to agree with CLDR. In anyways, please file a bug against CLDR: http://cldr.unicode.org – Steven R. Loomis Nov 11 '11 at 17:49
  • Sorry the links weren't working when I posted. The proper link is here: http://wiki.arabeyes.org/%D8%A2%D8%B1%D8%A7%D8%A1_%D8%AD%D9%88%D9%84_%D8%B5%D9%8A%D8%BA_%D8%A7%D9%84%D9%85%D8%B9%D8%AF%D9%88%D8%AF. Unfortunately the page is Arabic only - there is a link to an English version at the top - but the English version doesn't discuss the issue. Basically they leave the matter open for further submissions. I'll pursue the matter later - many thanks. – Basel Shishani Nov 12 '11 at 07:57
  • glad to help. The page says it was updated in 2008… I attempted to read it given machine translation and trying to sound out the Arabic words compared to Maltese (which I'm a little more familiar with). Wasn't totally clear to me. Please also see http://unicode.org/cldr/trac/ticket/1671 where there was some discussion. It would be important to cite some specific reference sources such as a dictionary or grammar at this point, or some written established documents as that bug claimed extensive review. – Steven R. Loomis Nov 13 '11 at 07:16

1 Answers1

1

I think you would need to create a PluralRules object using PluralRules.createRules() and then create your own PluralFormat using those rules and a pattern.

Steven R. Loomis
  • 4,228
  • 28
  • 39