This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Struts and the fly likes i18n Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "i18n " Watch "i18n " New topic
Author

i18n

Garandi Smith
Greenhorn

Joined: Apr 12, 2006
Posts: 1
Dear Reader,
In properties file I have the following

message.alphanumeric = A {0} contains only letters and numbers.

where {0} is replaced with the 2nd argument of

ActionError("message.alphanumeric", "Registration Number"); object.

However if I have message.alphanumeric in a different language, how to modify
ActionError(), to pick "Registration Number" in proper language from a properties file, instead of hard coding it?
Thanks in advance
Garandi
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Use the getResources() method in your Action superclass.

ActionError("message.alphanumeric", super.getResources(request, "registration.number.label"));

This method will get the message using the current locale, just as a <bean:message> would.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: i18n
 
Similar Threads
html:error to print specific error
HTML:Errors and Validate woes
Struts html:errors tag and JSP
struts-error
Loading from MessageResources.properties in Struts 2