a question about struts internationalization

how do i make my code to be internationalized?

suppose i have the code like this

ActionMessages errors =new ActionMessages();

errors.add("passwd",new ActionMessage("errors.name.required"));

[331 byte] By [bigdadismea] at [2007-10-2 16:47:24]
# 1
btw, this is in an action event
bigdadismea at 2007-7-13 17:58:17 > top of Java-index,Desktop,I18N...
# 2

Set your locale to the struts maintained session variable called "Globals.LOCALE_KEY".

For example, You want the messages to be displyed in Spanish like in Spain.

import javax.servlet.http.HttpSession;

import org.apache.struts.Globals;

import org.apache.struts.Globals;

import java.util.Locale;

..................

HttpSession session = request.getSession(false);

Locale sLocale = new Locale("es","SP");

session.setAttribute(Globals.LOCALE_KEY, sLocale);

If you need to maintain different languages on the same application and same locale, set the locale in Globals.LOCALE_KEY in struts action everytime the language button is clicked on the JSP.

Good Luck!!

Raj Palanichamy

bluehills73a at 2007-7-13 17:58:17 > top of Java-index,Desktop,I18N...