From the course: Spring: Spring MVC

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

CookieLocaleResolver and interceptor for l10n and i18n

CookieLocaleResolver and interceptor for l10n and i18n

From the course: Spring: Spring MVC

Start my 1-month free trial

CookieLocaleResolver and interceptor for l10n and i18n

- [Tutor] If you do not want to do automatic locale resolution you can also do it with interceptors. When it comes to locale resolvers in Spring MVC there are many implementations. A cookie locale resolver, a session locale resolver, a fixed locale resolver, et cetera, so when you talk about session locale resolver it'll use a locale attribute in the user's HTTP session for a custom setting. In case of a cookie locale resolver it is going to use a cookie which will send back to the user in case of the custom setting. So in this demo we are going to use a cookie locale resolver coupled with the locale change interceptor, which will help us to pass that query param. So the first step is to add the cookie locale resolver into our application, so let's go back to the IDE and grab our application config, and inside that let's register the bean for the cookie locale resolver. So I'm going to say public, locale resolver, and…

Contents