Geert,
So, do we really need to control the order of priority from outside
a Translator? Imho, yes. At least as soon as we don't want to do any
assumption about when each resourcebundle will be added to the list.
Well, I'm not so sure about this. People call the addResourceBundle
method manually, right?
Not always. For exemple it can be:
- through "plugins" like rife-crud: the crud bundles will be put at the
top of the list (see below the patch I use for CrudElement.decorateTemplate)
- and/or through site configuration: then the final element, for exemple
the Add one, can specify a required bundle basename, that will be put
above the crud ones in the list.
Can't they just call them in the correct order. I'll hear you say:
"Yeah but what when they need to add resource bundles in front when a
translator already has some?". Adding to the top doesn't solve that
either, since at a later time other resource bundles might be added
above again and obscure the properties too.
Yes indeed. But imo it's not an issue.
My point is, if there's a specific order that needs to be respected,
then the developer can easily handle this by adding all the resource
bundles one after the other in a reference factory or IoC container.
I don't think that explicitly adding to front or bottom helps.
I don't think that we need to control very exactly this order, but at
least to be able to deal with some simple cases.
If you think that addResourceBundle(s) with atTopPriority parameter is
too much complexity, there is always the possibilty to remove this
parameter and use getResources to work directly on the list. But then
the complexity is only transfered from inside the addResourceBundle
method to the caller. Imo such a solution is worse that the one with
atTopPriority parameter.
Regards
Pierre
PJ :
public Template decorateTemplate(Template template)
{
String[] bundleNames = new String[2];
bundleNames[0] = L10N_PREFIX_RESOURCEBUNDLE +
StringUtils.encodeClassname(mBeanClassName);
bundleNames[1] = L10N_CRUD_RESOURCEBUNDLE;
return decorateTemplate(
template
, Localization.getResourceBundles(bundleNames,
getTranslator().getLocales(), true)
, null
); // add bundles in top priority
}
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users