Hi Pierre,
good points. The next question is then, why not make "atTopPriority"
the default one? Wouldn't that make everybody happy through a single
method API? Is it needed to be able to add at the bottom?
Best regards,
Geert
On 11 Apr 2006, at 18:17, Raoul Pierre wrote:
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
--
Geert Bevin Uwyn bvba GTalk: [EMAIL PROTECTED]
"Use what you need" Avenue de Scailmont 34 Skype: gbevin
http://www.uwyn.com 7170 Manage, Belgium AIM: geertbevin
gbevin at uwyn dot com Tel: +32 64 84 80 03 Mobile: +32 477 302 599
PGP Fingerprint : 4E21 6399 CD9E A384 6619 719A C8F4 D40D 309F D6A9
Public PGP key : available at servers pgp.mit.edu, wwwkeys.pgp.net
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users