Intl ResourceBundle Class: No Fallback When Using Iteration

Joel Sahleen <[email protected]> Mon, 16 Aug 2010 14:05:52 -0700
Newsgroups gmane.comp.php.internationalization
Message-ID <C88F0450.2FD7%[email protected]>
--_000_C88F04502FD7jsahleenadobecom_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

All,

I am working on a large-scale internationalization project that use the int=
l extension. I am storing localized strings in ICU resource bundles and acc=
essing 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 a=
rray access (e.g., $bundle->get(=91KEY=92) or $bundle[=91KEY=92]), but if I=
 try to iterate over the en_US bundle=92s content with foreach, it returns =
a null result because the bundle is empty. Is there any way to support fall=
back when using iteration? It=92s not absolutely necessary for my project, =
but it seems that if the class is going to offer iteration support, that fu=
nctionality should also support the fallback functionality.

Thanks for the help.

Joel Sahleen
Software Engineer
Adobe Systems

--_000_C88F04502FD7jsahleenadobecom_--