Class HttpRequestXLanguageLocaleResolverImpl
java.lang.Object
ch.tocco.nice2.web.core.impl.servlet.locale.HttpRequestXLanguageLocaleResolverImpl
- All Implemented Interfaces:
LocaleResolver
,HttpRequestXLanguageLocaleResolver
@Component
@Order(0)
public class HttpRequestXLanguageLocaleResolverImpl
extends Object
implements HttpRequestXLanguageLocaleResolver
Holds the value of the X-Language request header.
-
Field Summary
Fields inherited from interface ch.tocco.nice2.textresources.spi.LocaleResolver
HIGH_PRIORITY, LOW_PRIORITY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturn the current locales in order of preference.void
setXLanguage
(@Nullable String xLanguage) Sets the X-Language request header.
-
Constructor Details
-
HttpRequestXLanguageLocaleResolverImpl
public HttpRequestXLanguageLocaleResolverImpl()
-
-
Method Details
-
setXLanguage
Sets the X-Language request header. Takes the first language (ignoring country) that is supported by nice.- Specified by:
setXLanguage
in interfaceHttpRequestXLanguageLocaleResolver
- Parameters:
xLanguage
- (may be null and empty)
-
getPreferredLocales
Description copied from interface:LocaleResolver
Return the current locales in order of preference.- Specified by:
getPreferredLocales
in interfaceLocaleResolver
- Returns:
- May be empty if the user is not logged in and the X-Language header is not set therefore.
The
locales
are ordered.
-