l0t3k wrote: > its actually worse than gettext().. > suppose we have an Apache process handling PHP scripts in different web > apps. When a script from app1 requests the resource bundle for "en_US" for > example, ICU performs the search, and if found the internal resource bundle > structure is cached. There is a lot that happens behind the scenes, for > example : file system path search for "en_US", fall back to "en" if not > found, searching for locales in .dat files and falling back to .res file if > not found, etc. Caching here makes sense, but the problem is that the cache > is process wide, and the cache key used is simply the ISO locale id passed > to the constructor, even if a full path to the resource file was specified. > There is nothing to distinguish two resource bundles using the same name in > different web apps, so when app 2 requests a bundle for "en_US", the cache > returns the bundle from app 1. The cache is also not flushed until the > process dies.
Maybe this has changed in the meantime? [EMAIL PROTECTED]:~/build/php-unicode-debug$ cli -r 'var_dump(new ResourceBundle("/home/mike/cvs/php-src/ext/unicode/tests/test"), new ResourceBundle("/home/mike/cvs/php-src/ext/unicode/tests/test2"));' object(ResourceBundle)#1 (4) { ["data"]=> unicode(5) "value" ["greet"]=> array(7) { ["1%4"]=> unicode(13) "Good morning." ["1%5"]=> unicode(15) "Good afternoon." ["1%7"]=> unicode(13) "Good evening." ["1%8"]=> unicode(11) "Good night." ["4%14"]=> unicode(7) "Please " ["4%19"]=> unicode(10) "Thank you." ["4%20"]=> unicode(10) "Sincerely," } ["list"]=> array(3) { ["one"]=> int(1) ["three"]=> string(1) "4" ["two"]=> unicode(1) "2" } ["serial"]=> array(3) { [0]=> int(1) [1]=> int(3) [2]=> int(5) } } object(ResourceBundle)#2 (1) { ["test"]=> unicode(4) "data" } It would really sound odd if it would be keyed by the locale only... > Internally, the cache uses a ref count for resource bundles, and there is > code to do a flush (its private), so technically there is a way to handle > this, but not without hacking the ICU source. i did this about 2 years ago, > but the machine i used was stolen ;-( > > > clayton -- Michael -- PHP Unicode & I18N Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php