That seems to be a bug.

Among other things, resourcebundle_iterator_read calls 
resourcebundle_extract_value instead of resourcebundle_array_get (which handles 
fallbacks via resourcebundle_array_fetch).

I'm not sure if the fix is that simple though, as that only fixes getting of 
values, but the iterated range probably still doesn't include the fallback 
values. What would the expected behavior be for iterators? Should it iterate 
over all contents, including fallbacks? You sent another message to the list 
earlier which appears to be describing a similar, but different problem where 
values are null when iterating?

- David



On 16.08.2010, at 23:05, Joel Sahleen wrote:

> All,
> 
> I am working on a large-scale internationalization project that use the intl 
> extension. I am storing localized strings in ICU resource bundles and 
> accessing them via the intl ResourceBundle class. Part of my project relies 
> on the fallback functionality of the ResourceBundle class. I have put all the 
> US English strings (base language) in the root bundle and created an empty 
> bundle for en_US as suggested in the ICU guide. That way if any string is 
> missing in the localized bundles, everything automatically falls back to US 
> English.
> 
> Fallback works great if I use the ResourceBundles get method, or if I use 
> array access (e.g., $bundle->get(‘KEY’) or $bundle[‘KEY’]), but if I try to 
> iterate over the en_US bundle’s content with foreach, it returns a null 
> result because the bundle is empty. Is there any way to support fallback when 
> using iteration? It’s not absolutely necessary for my project, but it seems 
> that if the class is going to offer iteration support, that functionality 
> should also support the fallback functionality.
> 
> Thanks for the help.
> 
> Joel Sahleen
> Software Engineer
> Adobe Systems

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to