IDPv3 internationalization via links and cookies
Simon Lundström
simlu at su.se
Thu Nov 5 03:25:19 EST 2015
On Wed, 2015-11-04 at 12:33:40 -0500, Brent Putman wrote:
>
>
> On 11/4/15 8:53 AM, Simon Lundström wrote:
>
> > The import works alright, but changing locale via the QS parameter still
> > doesn't work. This is my conf:
> >
> > <bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
> > <property name="paramName" value="lang"/>
> > </bean>
> > <bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
> > <property name="cookieName" value="lang"/>
> > </bean>
> > <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
> > <property name="interceptors">
> > <list>
> > <ref bean="localeChangeInterceptor"/>
> > </list>
> > </property>
> > </bean>
>
> No, that definitely won't work - putting the interceptor on the
> SimpleUrlHandlerMapping - because that's not the HandlerMapping that
> SWF uses. For that approach it would have to be added to that handler
> mapping in system/conf/mvc-beans.xml - which you can't modify. What I
> meant for you to test is the <mvc:interceptors> approach. You should
> be able to put that in the user-space mvc-beans.xml .
Ah!
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
<property name="cookieName" value="lang"/>
</bean>
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/**"/>
<bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="lang"/>
</bean>
</mvc:interceptor>
</mvc:interceptors>
Worked! Thank you very much Brent!
BR,
- Simon
More information about the users
mailing list