Hi,

I split the original message into two. See my comments below.

Tim Dawson wrote:
> 
> Marius Scurtescu wrote:
> > First, let me clarify this
> > [...]
> > The second may take the bundle name from an attribute or an
> > environment entry. The attribute name and scope and the
> > environment entry name are hard coded values.
> < [...]
> > I was proposing to use something like:
> > <i18n:localize bundle="com.wamnet.tools.jsptags.i18n-test"/>
> > or
> > <i18n:localize attr="org.apache.taglibs.i18n.LocalizeTag.bundle"/>
> > or
> > <i18n:localize env="org.apache.taglibs.i18n.LocalizeTag.bundle"/>
> >
> > This approach gives you two benefits:
> > - it makes it clear where the bundle name comes from
> > - you don't use hard coded values
> 
> ah, I see where you're going. though I'm not quite sure I agree, I'm open to
> exploring the idea.
> 
> the reason I had hardcoded the environment entry (and later, the
> application-scoped attribute) was that I considered it the equivalent of a
> servlet init param.  The reason the thing ended up so long was that I wanted
> the fully qualified classname to make sure I didn't step on anyone else's
> toes.

There is a similarity to init params indeed and the fact that you
use a long name is good. The problem I see is that you enforce the
same base name for the whole app and this means that you will have
to use one bundle for every single JSP page. While this may be
acceptable for small projects it is not a good general approach in
my opinion.


> 
> <sidebar>
> 
> The servlet init param is feature that IMHO should have an equivalent in the
> taglib descriptor!  OR, simply adding a <default> parameter to the taglib
> would be good as well (Craig - are you listening? :-)
> 
>     <attribute>
>       <name>bundle</name>
>       <default>com.wamnet.tools.jsptags.i18n-test</default>
>     </attribute>
> 
> </sidebar>
> 
> anyway, if you do servlet init params, the parameter names are hardcoded,
> e.g.
> <init-param>
>  <param-name>catalog</param-name>
>  <param-value>Spring</param-value>
> </init-param>
> 
> while I agree that your approach makes it clearer where the bundle name
> comes from, I wanted to provide a means for allowing an empty <localize/>
> tag. if the attr or env need to be passed, then one might as well just type
> in the actual name of the bundle to be used...
> 

Well, one of the things I wanted to prevent is using an empty <localize/> :)
Imagine that somebody has to do maintenance on some JSP pages and all he
sees is empty <localize/> tags. How would he figure what bundles to edit?

I agree with your that just using the name could be the same thing, and
actually that is the only way I would use it. It makes it very clear what
bundle you use.


Probably we have different opinions on this because we have different
approaches to localization: you tend to place everything in one bundle
and I tend to create one bundle for each page. Both approaches are good
and we should try to figure a taglib that will cover both.

Marius

Reply via email to