Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:36879 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91875 invoked from network); 8 Apr 2008 18:53:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Apr 2008 18:53:11 -0000 Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Windows 2000 SP4, XP SP1 Received: from [212.25.124.162] ([212.25.124.162:21217] helo=mx1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8C/93-09615-61FBBF74 for ; Tue, 08 Apr 2008 14:53:11 -0400 Received: from us-ex1.zend.com ([192.168.16.5]) by mx1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 8 Apr 2008 21:53:46 +0300 Received: from [192.168.16.94] ([192.168.16.94]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 8 Apr 2008 11:53:42 -0700 Message-ID: <47FBBF0F.4080505@zend.com> Date: Tue, 08 Apr 2008 11:53:03 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: Pierre Joye CC: Andi Gutmans , Lester Caine , PHP internals References: <47F463F0.4030407@zend.com> <47F560E4.7060609@zend.com> <47F5DC3D.6090302@lsces.co.uk> <47F677D9.4070804@zend.com> <47F68136.8040908@zend.com> <698DE66518E7CA45812BD18E807866CE0175729A@us-ex1.zend.net> <47FBA5A7.1070600@zend.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 08 Apr 2008 18:53:42.0880 (UTC) FILETIME=[DDBE0600:01C899A9] Subject: Re: [PHP-DEV] intl naming From: stas@zend.com (Stanislav Malyshev) Hi! > I did not find a way to do it in the manual or in the code. How do I > set in PHP? And how is it possible to use it as default for all > further calls (no matter which class/method)? Locale::setDefault() and Locale::DEFAULT. > That's why I would prefer an array (as named arguments). The keys We aimed to create a wrapper for ICU, not reinvent how PHP language works. So we accept arguments the usual way - through function parameters, not through arrays. > The locale as 1st argument always looked weird to me when I was > writing my test code. The reason is certainly because of the default I guess that's a matter of personal taste. > If right now is not within days but within 2 weeks, I can try to do > it. But I first like to hear Derick's idea on the topic before. Please > let us know your thoughts (wiki?) about this topic, it will certainly > spare us some precious time. Well, the thoughts here are pretty simple - where date formatting functions accept timestamp and localtime array, they should accept DateTime object too. Also, there should be parse function returning DateTime, like one that returns timestamp. I think if you look in CVS in doc folder, early versions of date formatter API mention that. > The idea is to have a way to get a code for a language, or to valid a > given code, etc. Many applications actually duplicate this list > internally, it would be very nice to be able to deal with the ICU > lists (display, validation, listings, etc.). You mean create API translating from language name in given locale to language code? I'm not sure ICU has this API. Locale class allows you to get components and display strings for the locales, but you have to have locale IDs first. There also are some matching functions in Locale, but I don't see any ICU functions allowing you to know IDs from external information, only to choose from set of IDs and enquire about ID. As for validity, since locale mechanism has a bunch of fallbacks, I understand the validity concept is a bit blurred. I.e. you can have regexp to check all the -'s or _'s are in place but beyond that it's kind of hard to know what the question "is en_RU locale valid?" means. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com