I'm new with Java and struts and I have to make an existing application multilingual.
In my application, Struts use the correct ApplicationResources.properties file according to the locale sets in the browser.
As I know, Struts is supposed to use the
org.apache.struts.Globals.LOCALE_KEY
sets in the session to display the correct language messages in the jsp pages.
To make a test, in my action method I have put
HttpSession session = request.getSession();
Locale locale = new Locale( "fr", "CA" );
session.setAttribute(org.apache.struts.Globals.LOCALE_KEY,locale);
The preferred language in my Browser is English [en]
In my jsp page I output:
out.println("Locale is :"+request.getLocale());
out.println("<br>");
out.println("Globals.LOCALE_KEY :"+session.getAttribute(org.apache.struts.Globals.LOCALE_KEY));
and I get:
Locale is :en
Globals.LOCALE_KEY :fr_CA
The messages are still in english and I have an Application.Resources_fr.properties file. It looks like Struts doesn't use the org.apache.struts.Globals.LOCALE_KEY but always the locale sets in the browser.
Is anybody knows how to solve this problem?
Thank you in advance.