Allow message bundles to specify a parent bundle with the key '__parent'.

This commit is contained in:
Ray J. Greenwell
2012-02-21 15:19:42 -08:00
parent 9936513cd5
commit 24c7dcc7f1
@@ -186,7 +186,17 @@ public class MessageManager
*/
protected void initBundle (MessageBundle bundle, String path, ResourceBundle rbundle)
{
bundle.init(this, path, rbundle, _global);
MessageBundle parentBundle = null;
try {
parentBundle = getBundle(rbundle.getString("__parent"));
// Note: if getBundle() fails to find our parent it will log a warning and return null
} catch (MissingResourceException mre ) {
// no resource named __parent: it's ok.
}
if (parentBundle == null) {
parentBundle = _global;
}
bundle.init(this, path, rbundle, parentBundle);
}
/**