Hello,
I'm trying to get the localized text based on
the locale that I set on my pageContext.
The MessageResources object seems to be ignoring
the "locale" when I try to retrieve the string,
it uses the default locale instead of the new locale.
I first create a locale object to set
the Action.LOCALE_KEY in the pageContext.
I get my MessageResource object from the
servletContext
which I use to get my localize text using the
getMessage(locale, "text.option.xxxx");
code:
Locale spanish = new Locale("es", "");
pageContext.setAttribute(Action.LOCALE_KEY, spanish,
PageContext.SESSION_SCOPE);
MessageResources messages = null;
servletContext = getServletContext();
messages = (MessageResources)servletContext.
getAttribute
(Action.MESSAGES_KEY);
String value = messages.getMessage(spanish,
"text.option.xxxx");
I do have the ApplicationResource_es.properties file.
Questions:
- The API doco says that it will use the default
locale to get the text. If that is the case what
is the use of the locale parameter?
- Am I using the wrong context?
- how do I make sure that I set and retrieve
the right text from the right file?
thanks for your help,
Brando
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/