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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionresolveLocale(javax.servlet.http.HttpServletRequest request) Return a non-nullbut possibly empty list ofLocaleinstances 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:
resolveLocalein interfaceLocaleResolver- Parameters:
request- TheSlingHttpServletRequestproviding hints and information for theLocaleresolution.- Returns:
- The list of
Locales to use for internationalization of request processing
-
resolveLocale
Description copied from interface:RequestLocaleResolverReturn a non-nullbut possibly empty list ofLocaleinstances to consider for localization of the current request. The list returned is assumed to be ordered by preference where the first entry is the preferredLocaleand 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:
resolveLocalein interfaceRequestLocaleResolver- Parameters:
request- TheHttpServletRequestproviding hints and information for theLocaleresolution.- Returns:
- The list of
Locales to use for internationalization of request processing - See Also:
-