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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn the current locales in order of preference.voidsetXLanguage(@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:
setXLanguagein interfaceHttpRequestXLanguageLocaleResolver- Parameters:
xLanguage- (may be null and empty)
-
getPreferredLocales
Description copied from interface:LocaleResolverReturn the current locales in order of preference.- Specified by:
getPreferredLocalesin interfaceLocaleResolver- Returns:
- May be empty if the user is not logged in and the X-Language header is not set therefore.
The
localesare ordered.
-