Package org.apache.sling.i18n
Class DefaultLocaleResolver
- java.lang.Object
-
- org.apache.sling.i18n.DefaultLocaleResolver
-
- All Implemented Interfaces:
LocaleResolver
,RequestLocaleResolver
public class DefaultLocaleResolver extends Object implements LocaleResolver, RequestLocaleResolver
TheDefaultLocaleResolver
resolves the request's Locale by calling theServletRequest.getLocales()
method, which generally will be the Servlet Container's implementation of this method and thus be based on the client'sAccept-Language
header.
-
-
Constructor Summary
Constructors Constructor Description DefaultLocaleResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Locale>
resolveLocale(HttpServletRequest request)
Return a non-null
but possibly empty list ofLocale
instances to consider for localization of the current request.List<Locale>
resolveLocale(SlingHttpServletRequest request)
Return the Locales provided by theServletRequest.getLocales()
method collected in aList
.
-
-
-
Method Detail
-
resolveLocale
public List<Locale> resolveLocale(SlingHttpServletRequest request)
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
public List<Locale> resolveLocale(HttpServletRequest request)
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:
RequestLocaleResolver.resolveLocale(javax.servlet.http.HttpServletRequest)
-
-