Hello,

2009/12/9 Jared Williams <jared.willia...@ntlworld.com>:
> Try...
>
> $fmt = MessageFormatter::create('en_GB', 'There are {0,choice,0#are no
> files|1#is one file|1<are many files} ok');
> ...

Thank you, the piece I was missing is "{0,choice ... " I appreciate
the response and the link.


On Wed, Dec 9, 2009 at 11:33 PM, Tomas Kuliavas
<to...@users.sourceforge.net> wrote:
> What's the point of using i18n code for basic "zero, one and many"
> decision. Your sample text does not have numbers and does not use plural
> forms. If that function can handle plural forms, then it should know

My example was straight from the documentation [1] but I missed a key
piece, as mentioned above
  -> $r = new MessageFormatter("en", "There are {0≤are no files|1≤is
one file|1<are many files} ok");
  -> $r = new MessageFormatter("en", "There are {0,choice,0≤are no
files|1≤is one file|1<are many files} ok");

This was non-obvious based off the research I did, a overlook perhaps
on my part. Furthermore NULL was not the expected result from a object
instantiation; hence my mail to this list. Obviously my snippet was
reduced from within a more complex internationalisation
implementation.

> formating rules based on language set in first argument and second
> argument should only set array of strings formated according to language
> rules. Second argument should not have to evaluate number every time
> translator wants to use plural form.

Pluralism is definitely a legitimate use case that is required within
my employers application; most seamlessly integrated by translation
services at the message formatter level. But hey, maybe your right...
ICU should just remove pluralism all together and we should use
arrays. Thanks for your useless response!

-Chris

[1] http://icu-project.org/apiref/icu4c/classChoiceFormat.html

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to