Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46399 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24957 invoked from network); 10 Dec 2009 06:40:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Dec 2009 06:40:02 -0000 Authentication-Results: pb1.pair.com header.from=tokul@users.sourceforge.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=tokul@users.sourceforge.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain users.sourceforge.net from 77.240.252.9 cause and error) X-PHP-List-Original-Sender: tokul@users.sourceforge.net X-Host-Fingerprint: 77.240.252.9 avilys.eik.lt Linux 2.6 Received: from [77.240.252.9] ([77.240.252.9:58773] helo=avilys.eik.lt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A1/E1-25115-FB7902B4 for ; Thu, 10 Dec 2009 01:40:00 -0500 Received: from avilys.eik.lt (avilys.local [127.0.0.1]) by avilys.eik.lt (Postfix) with ESMTP id 893531F5117 for ; Thu, 10 Dec 2009 08:33:14 +0200 (EET) Received: from avilys.eik.lt (avilys.local [127.0.0.1]) by avilys.eik.lt (Postfix) with ESMTP id 5F7901F5116 for ; Thu, 10 Dec 2009 08:33:14 +0200 (EET) Received: from 195.22.180.233 (NaSMail authenticated user tomas@topolis.lt) by avilys.eik.lt with HTTP; Thu, 10 Dec 2009 08:33:14 +0200 (EET) Message-ID: <4491.c316b4e9.1260426794.nsm@avilys.eik.lt> In-Reply-To: References: Date: Thu, 10 Dec 2009 08:33:14 +0200 (EET) To: internals@lists.php.net User-Agent: NaSMail/1.7-dev MIME-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Scanned: ClamAV using ClamSMTP Subject: Re: [PHP-DEV] Intl extension class MessageFormatter instantiation returns NULL From: tokul@users.sourceforge.net ("Tomas Kuliavas") 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 // $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