Current File(s): conf/mvc-beans.xml
Format: Native Spring
This is a V3.2 feature.
Spring provides many ways to change locale, this documentation will describe how to change it via an URL query string parameter and how to persist it with a cookie.
Locale cookie persistance
Enabling locale change persistance via a cookie is done by defining the CookieLocaleResolver bean and optionally changing it's defaults:
Here we changed the cookiename to be
lang instead. Now you can set a cookie called
lang to be any locale your IDP supports, e.g.
URL query string based locale changing
To change the locale via an URL query string parameter you have to define two beans: a LocaleChangeInterceptor that will inspect request parameters and a LocaleResolver that will remember the locale change, like the CookieLocaleResolver above or SessionLocaleResolver (the present-by-default AcceptHeaderLocaleResolver does not allow locale changes).
Here we enabled changing the locale based on the URL query string parameter
lang and set a fallback locale of "en".
See documentation for: