Otherwise, the default configuration of theMashup UI is to use a LocaleResolver
called CookieLocaleResolver
. This is a Spring interface that will:
-
either send the locale stored in a cookie (/mashup-ui/lang/{locale}
), which is created when the user selects a language, for example, when using the language selector widget.
-
or, if there is no cookie, send either:
-
the default language (none set by default)
-
or the request's accept-header locale, which is the browser's language.
This resolver is configured in <DATADIR>/webapps/360-mashup-ui/WEB-INF/360-search-ui.xml
:
<bean id="localeResolver" class="com.exalead.cv360.searchui.handler.CookieLocaleResolver">
<!--<property name="defaultLocale" value="en"/>-->
<property name="cookieName" value="clientlanguage"/>
<property name="cookieMaxAge" value="100000"/>
</bean>
You may want to modify the LocaleResolver
to enforce
the language so that it will not be determined by the browser or be editable
by users. Note that several implementations are available out-of-the-box:
-
AcceptHeaderLocaleResolver
– uses the primary locale
specified in the "accept-language" header of the HTTP request.
-
FixedLocaleResolver
– always returns a fixed default
locale.
-
SessionLocaleResolver
– uses a locale attribute in
the user's session in case of a custom setting, with a fallback to the
specified default locale or the request's accept-header locale.
-
CookieLocaleResolver
– uses a cookie sent back to
the user in case of a custom setting, with a fallback to the specified
default locale or the request's accept-header locale.