struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "None None" <fzamm...@hotmail.com>
Subject RE: MessageResources Problem in Action
Date Tue, 01 Jun 2004 13:15:55 GMT
I use the following code:

myActionForm.setMessage(getResources(request).getMessage(getLocale(request), 
"messages.deleteFailed"));

I have two property files, ofmResources_en.properties and 
ofmResources_de.properties.  The above code fetches the 
messages.deleteFailed message from the appropriate file, depending on what 
the current Locale is.  Note that Struts seems to be smart enough to just 
use the _en or _de portion of the Locale, it looks to ignore the _AT (the 
country code I think?) portion of it.  Not sure this is truly a good thing, 
but it seems to be the case in my experience.

>From: Ralf Schneider <ralf@tapfere-schneiderleins.de>
>Reply-To: "Struts Users Mailing List" <user@struts.apache.org>
>To: Struts Users Mailing List <user@struts.apache.org>
>Subject: MessageResources Problem in Action
>Date: Tue, 1 Jun 2004 12:23:23 +0200
>
>Hi,
>
>I want to access the strings in a resource bundle from within an action. I
>have two resource files (ApplicationResources.properties and
>ApplicationResources_de.properties) and they are accessed correctly from 
>the
>JSP, but not from the action.
>
>When I look at the locale with request.getLocale() in the action I see that 
>it
>is set to de_AT. This is what I expected. Unfortunately, the strings are
>fetched from ApplicationResources.properties, not from
>ApplicationResources_de.properties as they should be.
>
>I use this code to get a string from the resource bundle:
>
>	MessageResources messages = getResources (request);
>	String msg = messages.getMessage("rights.new");
>
>Any ideas what might be the problem?
>
>Thanks,
>Ralf.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>

_________________________________________________________________
Learn to simplify your finances and your life in Streamline Your Life from 
MSN Money. http://special.msn.com/money/0405streamline.armx


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message