Spring 和 Velocity 的 i18n(国际化)问题
我在使用 Spring 设置国际化时遇到问题。 这是我的配置。
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="localization" />
</bean>
<!-- declare the resolver -->
<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
<property name="defaultLocale" value="sv" />
</bean>
<mvc:interceptors>
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />
</mvc:interceptors>
<mvc:annotation-driven />
即使我使用 ?locale=sv
(瑞典语)请求,它也总是显示英语。
我正在使用 Spring 和 Velocity。
有什么想法吗? 谢谢
I am having a problem in setting up internationalization with Spring.
Here is my config.
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="localization" />
</bean>
<!-- declare the resolver -->
<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
<property name="defaultLocale" value="sv" />
</bean>
<mvc:interceptors>
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />
</mvc:interceptors>
<mvc:annotation-driven />
It always showing me English even when I request with ?locale=sv
(Swedish).
I am using Spring with Velocity.
any idea?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这就是我的做法:
首先在
src/main/resources
中复制messages_xx.properties
我无法让它使用名称
messages_xx_xx
(messages_en_us)然后将以下配置添加到 xxxx_servlet.xml 上下文
*.vm
中使用了#springMessages('message.title')
就是这样。
This is how I did:
First copied
messages_xx.properties
insrc/main/resources
I could not get it to work with name
messages_xx_xx
(messages_en_us)Then just added following configs to xxxx_servlet.xml context
#springMessages('message.title')
in my*.vm
that was it.