Vernon,

The last time I checked the Pet Store application does not use Struts.  If
you look at the Struts source code you will find that the user's locale is
stored in session and is later used when reconciling which message resources
to use.  Look at the processLocale() method from the RequestProcessor below
(very similar to the processLocale() in ActionServlet for 1.0.2).


Jeff, 

It appears you are doing everything right.  I think you're right in saying
there is something small that you're missing.  You shouldn't need to change
any localization settings through Control Panel.  The browser setting is
what is sent with your request.  I'm sorry I couldn't be of more help.

Russ


protected void processLocale(HttpServletRequest request,
                                 HttpServletResponse response) {

        // Are we configured to select the Locale automatically?
        if (!appConfig.getControllerConfig().getLocale()) {
            return;
        }

        // Has a Locale already been selected?
        HttpSession session = request.getSession();
        if (session.getAttribute(Action.LOCALE_KEY) != null) {
            return;
        }

        // Use the Locale returned by the servlet container (if any)
        Locale locale = request.getLocale();
        if (locale != null) {
            if (log.isDebugEnabled()) {
                log.debug(" Setting user locale '" + locale + "'");
            }
            session.setAttribute(Action.LOCALE_KEY, locale);
        }

    }

-----Original Message-----
From: Vernon Wu [mailto:vernonw@;gatewaytech.com]
Sent: Monday, October 21, 2002 4:30 PM
To: [EMAIL PROTECTED]
Subject: re. i18n



I saw the following statement in today mail archive.

        Also keep in mind that the locality is stored in session.  This
means you
        cannot switch languages while using the same session.  The best way
to test
        is by setting your language, close and reopen your browser.

This statement is not true. The Pet Store allows users change the locale
anywhere in the middle of session. You can 
test out yourself by driving a demo version from 
http://developer.java.sun.com/developer/technicalArticles/J2EE/deployathon3/

BTW, the locale information management, including changing locale method,
demonstrated in the latest version PS is 
not the best way by today's standard. Take a look at JSP/JSTL articales on
onjava.com by Hans Bergsten.

Hope this helps.

Vernon



--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>

Reply via email to