Re: intl/resourcebundle

From: Date: Tue, 15 Dec 2009 07:25:58 +0000
Subject: Re: intl/resourcebundle
References: 1 2  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-6918@lists.php.net to get a copy of this message
Hi! Stanislav Malyshev wrote: > First of all, I think it's great that you want to work on this module, > it was long on the TODO list. Do you have the code in public anywhere? Is there a preferred pastebin for php/pecl? (I will send you a diff to 1.0.3 directly) > Most of other modules have locale as the first param. Default locale can > be specified as Locale::DEFAULT_LOCALE. Yes, I see, the MessageFormatter takes locale first, too. I will change "my" order, of course. > I'm not very familiar with this part of ICU, but looks like > udata_setAppData could be helpful. Also, env variable can be overridden > by u_setDataDirectory() (though this one is not thread-safe, so we > probably shouldn't use it). You're right, BUT: setAppData only works if I have ONE file. libicu can have a single .dat (multiple locales) or several .res (per locale) for ResourceBundles. Probably a static ResourceBundle::setLocation which modifies $ENV[ICU_DATA]? (Which is not thread-safe either...) > I think this class should implement ArrayAccess - it looks natural, and > I don't see how it's substantially more expensive than calling get. It Sorry for the misunderstanding: It's not ArrayAccess that's more expensive than get(); but accessing a resource (either way) is far more expensive than a simple array access - probably reading multiple files. ArrayAccess just "feels" too leightweight for me ;) If you disagree, I will - of course - look up ArrayAccess and add it. > It must have some order, not? Is it that bad that it's better to have > none? Anyway, I think the fact that you get all of them one by one may > be more important than order... I implemented an iterator, by using numerically indexed access internally. That way, it always has a "key" to return - whereas with the native functions, no key would be available for arrays. Hans-Peter

« previous php.pecl.dev (#6918) next »