Ciao tutti,
I have been trying to figure out how to make the <struts:message>
tag work for
us (InterAge) while developing multi-language web sites. The problem
is that we
want to be able to manually set a language and have all the text
in that
language, from there on (for reasons I won't speculate about), but
I didn't
find a way to do it. Sure, you can specify a Locale with the "locale"
parameter, but it's unnecessarily awkward (and inefficient) way
of operating if
we just need to change the language once during a session.
Btw, I would really like that the "locale" parameter was
<rtexprvalue>true</rtexprvalue> so we could use a variable
to indicate the
locale to use, while now is "false".. Can this be set as a default
in the main
struts distribution? If not, is there a reason why? (just asking)
The question is: did I miss something that could let us set the locale
once and
forget about the "locale" parameter in the "message" tag? If not,
can I go on
and create a small tag (to be of course donated to the Struts project)
that
simply sets the new default locale until further notice?
From what I could see it is just a matter of setting an object in
the session
scope, retrieving the object name with the help of Action.LOCALE_KEY,
but if
there is some caveat it'd be great to know. Thanks guys/gals.
Yep.. Just set the session Action.LOCALE_KEY attribute to what you want it to be.
Or, you could over-ride the 'processLocale' method in the ActionServlet class. We use the new method to check if the 'debug' value is set in the web.xml. If so, then the locale is set the curent request locale. This allows our developers to test multiple languages 'on the fly'.
Pete
--
Max
begin:vcard n:; x-mozilla-html:FALSE org:<BR><IMG SRC="http://www.irista.com/logo/irista.gif"><BR><BR><FONT Color=#000080><FONT SIZE=2><B>Bringing Vision to Your Supply Chain adr:;;;;;; version:2.1 end:vcard