【问题标题】:Spring webflow InternationalizationSpring webflow 国际化
【发布时间】:2014-08-21 12:05:47
【问题描述】:

最近,我正在研究春季国际化。目前项目是用spring webflow搭建的。

我浏览了很多关于 spring 国际化的资料,并尝试了许多不同的配置。还是不行。

xml 文件在这里:

<mvc:interceptors>
    <bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
            <property name="paramName" value="sitelocale" />
    </bean>
</mvc:interceptors>
      <bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
          <property name="defaultLocale" value="cn" />
      </bean>

      <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
          <property name="basename" value="classpath:test"/>
      </bean>

当我更改 defaultLocale 时,我可以看到字符发生了变化,我认为这可能是我的拦截器无法正常工作。当我使用 ?sitelocale=en 或其他语言环境手动更改 url 时,它不起作用。

我已经坚持了整整一周,谁能帮帮我。

【问题讨论】:

    标签: spring-webflow


    【解决方案1】:

    我找到了解决方案。我将localeResolver从SessionLocaleREsolver更改为CookieLocaleResolver,终于成功了。

    我想是因为我只初始化了一次会话,它会存储一次区域设置。这只是一个猜测,更多细节,我会再次检查。

    【讨论】:

    • 如何设置刷新页面的 url? @zzyclark
    猜你喜欢
    • 1970-01-01
    • 2016-02-23
    • 1970-01-01
    • 1970-01-01
    • 2019-02-18
    • 1970-01-01
    • 2017-10-27
    • 2015-10-17
    • 2017-12-12
    相关资源
    最近更新 更多