[Seasar-user:17489] Re: [Teeda] アプリの実装でロケールを変更すること

Koichi Kobayashi [E-MAIL ADDRESS DELETED]
2009年 5月 20日 (水) 00:30:29 JST


小林 (koichik) です.

Date:    Wed, 20 May 2009 00:04:24 +0900
From:    thomas <[E-MAIL ADDRESS DELETED]>
To:      [E-MAIL ADDRESS DELETED]
Subject: [Seasar-user:17488] [Teeda] アプリの実装でロケールを変更すること

>                 if*
> (request.getLocale().getLanguage().equals((String)session.getAttribute("language"))
> *){
>                     System.out.println("same");
>                    * chain.doFilter(request,response);*
>                     return;
>                 }
>                 else{
> 
> *//How can i change the locale here*

I wrote in [Seasar-user:17460]
> > 2. Filter create a wrapper for an HttpServletRequest.
> > 3. getLocale() and getLocales() methods of the wrapper 
> >    return the Locale from an HttpSession.

then

                      final Locale locale = new Locale((String) session.getAttribute("language"));
                      request = new HttpServletRequestWrapper((HttpServletRequest) request) {
                          public Locale getLocale() {
                              return locale;
                          }
                          public Enumeration getLocales() {
                              Vector v = new Vector();
                              v.add(locale);
                              return v.elements();
                          }
                      };




-- 
<component name="koichik">
    <property name="fullName">"Koichi Kobayashi"</property>
    <property name="email">"[E-MAIL ADDRESS DELETED]"</property>
    <property name="blog">"http://d.hatena.ne.jp/koichik"</property>
</component>



Seasar-user メーリングリストの案内