- Add the follwoing bean definitions in "{project}-sevlet.xml"
<!-- Add for Internationlization -->
<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.SessionLocaleResolver">
</bean> - Use the following "<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> from "ResourceBundleMessageSource" to "ReloadableResourceBundleMessageSource".
- Add "classpath:" prefix to all the messages in the "basenames" property.
- Add the "<ref bean="localeChangeInterceptor"/>" as an interceptor to "urlMapping" bean.
- Create sepearte "{Messsage}_{lang}.properties file.
- Change the language by submitting "?lang={lang}" and appropriately the messages will be loaded from the language.
Wednesday, January 11, 2012
Internationlization in Spring
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment