views:

17

answers:

0

I'm trying to add localisation to my web app which is built with Spring WebFlow and facelets. I want to add support for english and french. I've created my two messages_fr.properties and messages_en.properties files.

My template which I use for all my jsf pages has the following code to define the messages bundle and two links to switch between french and english.

<f:loadBundle basename="messages" var="msg" />
...
<h:commandLink id="changeLocaleFr" action="changeLocale"
class="flag fr">
    <f:param name="ln" value="fr" />
</h:commandLink>
<h:commandLink id="changeLocaleEn" action="changeLocale"
class="flag en">
    <f:param name="ln" value="en" />
</h:commandLink>

I've set up a session local resolver

<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver" />

and a local change interceptor

<bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
    <property name="paramName" value="ln" />
</bean>

which I added to my flow handler mapping

<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
    <property name="flowRegistry" ref="flowRegistry" />
    <property name="interceptors">
        <list>
            <ref bean="localeChangeInterceptor"></ref>
        </list>
    </property>
    <property name="order" value="0" />
</bean>

In my flow I have a global transition for changeLocale

<global-transitions>
    <transition on="changeLocale" />
</global-transitions>

All this is almost working. When I click on one of the links, the locale is changed. But I don't see the changes immediatly, I have to manually refresh or navigate to another view to rerender the page with the new langage being used. How can I make the changes appear immediatly after clicking on the link ?