"Craig R. McClanahan" wrote:

> On Tue, 20 Mar 2001, 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.
> >
>
> You are correct about the implications of using multiple application
> resource bundles -- it's a lot of work, but definitely feasible.
>
> One alternative strategy to consider is to keep the application resource
> bundles separate in your *source* code, but combine them together when you
> deploy the application (for example, you can use the unix "cat" command or
> the DOS "copy" command to combine text files).  As long as the message
> keys are all unique (which you should manage by requiring specific
> prefixes for different portions of the app), this will still work fine.
>
> The same basic strategy can be used to allow different developers to work
> on their own portions of the "struts-config.xml" file in the source code,
> but combine them all together when you create the application itself.
>
> > Thanks,
> > Ken
> >
> >
> Craig

Duh, cat.  why didn't I think of that.  use it every day, but didn't even
cross my mind here.   I'll just make sure my message keys are unique.
Anyone have a snippet of a build.xml that's does this "combining" of
the properties files?

Ken

PS -Struts rules!, I was looking for a nice way to separate JSP Java
and HTML and I feel Struts is really excellent for this.  You've all
done a great job developing it and supporting us newcomers.   Keep up
the great work everyone!


Reply via email to