2009.12.09 22:38 Chris Stockton rašė:
> Hello,
>
> I am trying to use ChoiceFormat in the Intl extension. When I try to
> do something like:
>
> $r = new MessageFormatter("en", "There are {0≤are no files|1≤is one
> file|1<are many files} ok");
> // $r is NULL
>
> This may be a incorrect use, but my thought is that regardless null
> should not be returned because no error code or error message can be
> returned. I also can not think of a single case off the top of my head
> when new does not return a object (aside from a exception being thrown
> on instantiation).
>
> I am struggling to find documentation on plural usage. There is no
> "ChoiceFormatter" class so it is my assumption that message formatter
> parses that format. I would very much appreciate if someone was able
> to point me in the right direction. My apologies if this may have been
> better suited on PECL list, but subscribing appears down and I am
> hastily in search for a answer.

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
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.


-- 
Tomas


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

Reply via email to