The Shibboleth IdP V3 software has reached its End of Life and is no longer supported. This documentation is available for historical purposes only. See the IDP4 wiki space for current documentation on the supported version.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Current File(s): conf/mvc-beans.xml

Format: Native Spring

This is a V3.2 feature.

Overview

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.

General Configuration

Locale cookie persistance

Enabling locale change persistance via a cookie is done by defining the CookieLocaleResolver bean and optionally changing it's defaults:

CookieLocaleResolver configuration
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
  <property name="cookieName" value="lang"/>
</bean>

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. en_GB . This can be done via Javascript e.g. or use the LocaleChangeInterceptor below.

URL query string based locale changing

To change the locale via an URL query string parameter you have to enable it via an interceptor:

LocaleChangeInterceptor configuration
<mvc:interceptors>
  <mvc:interceptor>
    <mvc:mapping path="/**"/>
    <bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
      <property name="paramName" value="lang"/>
    </bean>
  </mvc:interceptor>
</mvc:interceptors>

Here we enabled changing the locale based on the URL query string parameter lang. This will be persisted to the cookie, if you configured it above.

Reference

See documentation for:

 

 

  • No labels