File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "i18n " Watch "i18n " New topic


Garandi Smith

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
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.

Consultant, Sima Solutions
I agree. Here's the link:
subject: i18n
It's not a secret anymore!