To have a separate property file for each JSP - it is too much. All the rest - a good
idea.
I am creating my servlet that extends ActionServlet and does two things: expending
destroy and init functions. The reason - I have to initialize some paramaters that I
will use in xxxAction through application attributes.

Other thing you need to remember that all xxx_xx.properties files do not need to have
all messages that in the xxx.properties file. Only what is different.

Maya


Ken Beyer wrote:

> I'm struggling with something very similar and could really
> use a recommendation.
>
> In the Building View Components documentation about i18n,
> (http://jakarta.apache.org/struts/userGuide/building_view.html),
> it describes using a MyResources.properties (default) and
> other MyResources_XX.properties for other languages.
> This uses the "application" init-param of the ActionServlet in web.xml.
> That's fine and dandy for a small application, but....
>
> for a large JSP application, I don't think I want to maintain *all* my
> i18n text (including images!) in a single file per language.
> I'm thinking the best way to break this up is to put some "common"
> text in a file like CommonResources.properties.  Put my images in
> a file like ImageResources.properties.  And finally put text that
> is unique to each JSP file in their own properties files (for example
> Foo.jsp -> FooResources.properties, Bar.jsp -> BarResources.properties,
> etc.) - and I realize that for each language, I'd need a
> BarResources_DE.properties for example, but that's okay.
> I think that each of these ResourceBundle's needs to be put under their
> own application scoped bean/key, i.e. imageresource ->
> com.mycompany.mypackage.ImageResources.
>
> Question is, is this the right approach?  If so, how do I do this?
> I think I use ... bundle="fooresource" via each struts tag, (i.e.
> <html:img pageKey="welcome.gif" bundle="imageresource" border="0"/>)
> And I'd have to load that  in advance via each controller servlet (or should
> I extend org.apache.struts.action.ActionServlet and load them all there).
> Is this all correct?   A pointer to an example would help me greatly.
>
> Thanks,
> Ken
>
> Maya Muchnik wrote:
>
> > Craig,
> >
> > Can I ask you on an example to be sure, that it is correct.
> > My images are under images directory from root application dir. So, I can put the
> > following statements:
> > (in a property file :
> > message.key=images
> > a.image=a.gif
> > a.image.dir=images/a.gif
> > )
> >
> > <html:image pageKey="message.key"/>
> > ...
> > <html:image src="a.gif"/>
> > ...
> >
> > Can I put a.gif into the property file too, and have the second statement as
> > this:
> > <html:image src="a.image"/>
> > Or I can have
> > <html:image srcKey="a.image.dir"/>
> >
> > Thanks,
> >
> > Maya
> >
> > "Craig R. McClanahan" wrote:
> >
> > > There was a recent addition to the <html:image> and <html:img> tags to
> > > support internationalized images elegantly.
> > >
> > > Previously, you had to use the "src" attribute to specify the URI of your
> > > image.  If you needed different images for each language, you had to use a
> > > scriptlet expression of some sort to calculate them.
> > >
> > > Now, you can specify a message key (to be looked up in your application
> > > resources) instead:
> > >
> > >         <html:image srcKey="message.key"/>
> > >
> > > where "message.key" identifies the path to this image from your
> > > application resources.
> > >
> > > If you want to use context-relative paths everywhere, use:
> > >
> > >         <html:image pageKey="message.key"/>
> > >
> > > instead.
> > >
> > >
> > >
> > > Craig
>
> --
> Ken Beyer
> Metatec Internet Products Group
> [EMAIL PROTECTED]  |  http://www.metatec.com/
> "The box said 'Requires Windows 95 or better.' - so I installed Linux."

Reply via email to