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
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php