Package org.apache.sling.i18n
Class DefaultLocaleResolver
java.lang.Object
org.apache.sling.i18n.DefaultLocaleResolver
- All Implemented Interfaces:
LocaleResolver
,RequestLocaleResolver
The
DefaultLocaleResolver
resolves the request's Locale by
calling the ServletRequest.getLocales()
method, which generally
will be the Servlet Container's implementation of this method and thus be
based on the client's Accept-Language
header.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionresolveLocale
(javax.servlet.http.HttpServletRequest request) Return a non-null
but possibly empty list ofLocale
instances to consider for localization of the current request.resolveLocale
(SlingHttpServletRequest request) Return the Locales provided by theServletRequest.getLocales()
method collected in aList
.
-
Constructor Details
-
DefaultLocaleResolver
public DefaultLocaleResolver()
-
-
Method Details
-
resolveLocale
Return the Locales provided by theServletRequest.getLocales()
method collected in aList
.- Specified by:
resolveLocale
in interfaceLocaleResolver
- Parameters:
request
- TheSlingHttpServletRequest
providing hints and information for theLocale
resolution.- Returns:
- The list of
Locale
s to use for internationalization of request processing
-
resolveLocale
Description copied from interface:RequestLocaleResolver
Return a non-null
but possibly empty list ofLocale
instances to consider for localization of the current request. The list returned is assumed to be ordered by preference where the first entry is the preferredLocale
and the last entry is the least preferredLocale
.Returning an empty list is equivalent to returning a singleton list whose single entry is the
ResourceBundleProvider.getDefaultLocale()
.- Specified by:
resolveLocale
in interfaceRequestLocaleResolver
- Parameters:
request
- TheHttpServletRequest
providing hints and information for theLocale
resolution.- Returns:
- The list of
Locale
s to use for internationalization of request processing - See Also:
-