Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:36888 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46582 invoked from network); 8 Apr 2008 22:08:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Apr 2008 22:08:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=dz@bitxtender.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=dz@bitxtender.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain bitxtender.com from 80.237.132.12 cause and error) X-PHP-List-Original-Sender: dz@bitxtender.com X-Host-Fingerprint: 80.237.132.12 wp005.webpack.hosteurope.de Received: from [80.237.132.12] ([80.237.132.12:56717] helo=wp005.webpack.hosteurope.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 12/FC-09615-0CCEBF74 for ; Tue, 08 Apr 2008 18:08:00 -0400 Received: from dslb-088-064-209-013.pools.arcor-ip.net ([88.64.209.13] helo=[192.168.0.100]); authenticated by wp005.webpack.hosteurope.de running ExIM using esmtpsa (TLSv1:RC4-SHA:128) id 1JjLyu-00023Q-K8; Wed, 09 Apr 2008 00:07:56 +0200 Cc: "Stanislav Malyshev" , "Andi Gutmans" , "Lester Caine" , "PHP internals" Message-ID: <9E824A53-4FF3-4BA7-84DD-C6D7A875FCB8@bitxtender.com> To: Pierre Joye In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v919.2) Date: Wed, 9 Apr 2008 00:07:55 +0200 References: <47F463F0.4030407@zend.com> <47F677D9.4070804@zend.com> <47F68136.8040908@zend.com> <698DE66518E7CA45812BD18E807866CE0175729A@us-ex1.zend.net> <47FBA5A7.1070600@zend.com> <47FBBF0F.4080505@zend.com> X-Mailer: Apple Mail (2.919.2) X-bounce-key: webpack.hosteurope.de;dz@bitxtender.com;1207692480;508a3e5b; Subject: Re: [PHP-DEV] intl naming From: dz@bitxtender.com (=?ISO-8859-1?Q?David_Z=FClke?=) Am 08.04.2008 um 21:09 schrieb Pierre Joye: >>> 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. > > It is amazingly handy to know that a locale given by the user (UI or a > developer using your library) is valid. What I like to have are > getCountry, getISO3* etc. I can provide a list and then a patch. Note that most of this info is already in the CLDR info. And I am with Stas here, not sure if it's really necessary. You can do this mapping by hand, if necessary, but trust me, it isn't in most cases; you know the locale IDs beforehand. David