In a web application written using spring-MVC, I want to allow users to change the current language by clicking on the link whose text is the name of the language.
I already created messageSource and made all my jsp pages search for messages using this messageSource. Currently, the language changes depending on the locale of the user browser.
So now I want to do it manually.
I found that the SessionLocaleResolver class can help, but I don’t know how to configure it in the application context file (which name is myAppName-servlet.xml).
I defined a bean:
<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
</bean>
But in which bean should I plug this in? Also, how to set a cookie associated with a locale in a user session?