Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46394 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76309 invoked from network); 9 Dec 2009 23:33:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Dec 2009 23:33:14 -0000 Authentication-Results: pb1.pair.com header.from=jared.williams1@ntlworld.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=jared.williams1@ntlworld.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ntlworld.com designates 81.103.221.47 as permitted sender) X-PHP-List-Original-Sender: jared.williams1@ntlworld.com X-Host-Fingerprint: 81.103.221.47 mtaout01-winn.ispmail.ntl.com Solaris 10 (beta) Received: from [81.103.221.47] ([81.103.221.47:47430] helo=mtaout01-winn.ispmail.ntl.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2F/3A-25115-4B3302B4 for ; Wed, 09 Dec 2009 18:33:12 -0500 Received: from aamtaout04-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20091209233305.BIBL17029.mtaout01-winn.ispmail.ntl.com@aamtaout04-winn.ispmail.ntl.com>; Wed, 9 Dec 2009 23:33:05 +0000 Received: from p2 ([82.0.126.169]) by aamtaout04-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20091209233305.CSEX22934.aamtaout04-winn.ispmail.ntl.com@p2>; Wed, 9 Dec 2009 23:33:05 +0000 To: "'Chris Stockton'" , "'PHP Developers Mailing List'" Date: Wed, 9 Dec 2009 23:34:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-Reply-To: Thread-Index: Acp5D7AiBnhGI/pBQL2EF7JnLrfzkQAGFhUg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4325 Message-ID: <20091209233305.CSEX22934.aamtaout04-winn.ispmail.ntl.com@p2> X-Cloudmark-Analysis: v=1.1 cv=1ggfb5FlKZQUfF3vzm9UBYZ2uTfLsbs/8dSljwg5+mE= c=1 sm=0 a=CdwJVakbEi0A:10 a=pGLkceISAAAA:8 a=0homCqhpAAAA:8 a=fySvnGAu-Bx7otStwbUA:9 a=bPU5E7hOj5vjYHYKqsYA:7 a=wLopB6xf6kFKDRoP7XjnpGRJzvoA:4 a=MSl-tDqOz04A:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Subject: RE: [PHP-DEV] Intl extension class MessageFormatter instantiation returns NULL From: jared.williams1@ntlworld.com ("Jared Williams") References: > -----Original Message----- > From: Chris Stockton [mailto:chrisstocktonaz@gmail.com] > Sent: 09 December 2009 20:39 > To: PHP Developers Mailing List > Subject: [PHP-DEV] Intl extension class MessageFormatter > instantiation returns NULL > > 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. > > -Chris > Try... $fmt = MessageFormatter::create('en_GB', 'There are {0,choice,0#are no files|1#is one file|1format(array(0)), "\n"; echo $fmt->format(array(1)), "\n"; echo $fmt->format(array(10101)), "\n"; Best place for documentation is tests, or example code I find. http://userguide.icu-project.org/formatparse/messages/examples Jared