You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jonathan <ja...@i-2000.com> on 2001/04/24 23:42:18 UTC

Is the Local object a given in Struts ?

Do we get a Local object when we use struts, or do we have to implement it?  It look like I get a default Local object for free, but if I want to be able to change languages on the fly I have to implement more Local objects.  The documentation says:

"When the user logs on, the application can store a Locale object in the user's session. This Locale will be used to select messages in the appropriate language. This makes it easy to implement giving the user an option to switch languages -- simply change the stored Locale object, and all messages are switched automatically."


simply change the stored Locale object, and all messages are switched automatically, H-O-W   DO I "SIMPLY" CHANGE THE STORED LOCAL OBJECT  ?!!

Re: Is the Local object a given in Struts ?

Posted by David Winterfeldt <dw...@yahoo.com>.
If a Locale object isn't in scope, the ActionServlet
will make one based on Locale.getDefault().  You can
change it like this.

session.setAttribute(org.apache.struts.action.Action.LOCALE_KEY,
new java.util.Locale("fr", ""));

David



--- Jonathan <ja...@i-2000.com> wrote:
> Do we get a Local object when we use struts, or do
> we have to implement it?  It look like I get a
> default Local object for free, but if I want to be
> able to change languages on the fly I have to
> implement more Local objects.  The documentation
> says:
> 
> "When the user logs on, the application can store a
> Locale object in the user's session. This Locale
> will be used to select messages in the appropriate
> language. This makes it easy to implement giving the
> user an option to switch languages -- simply change
> the stored Locale object, and all messages are
> switched automatically."
> 
> 
> simply change the stored Locale object, and all
> messages are switched automatically, H-O-W   DO I
> "SIMPLY" CHANGE THE STORED LOCAL OBJECT  ?!!
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/