Class PrincipalLocaleResolver

java.lang.Object
org.craftercms.engine.util.spring.servlet.i18n.ConfigAwareLocaleResolver
org.craftercms.engine.util.spring.servlet.i18n.PrincipalLocaleResolver
All Implemented Interfaces:
org.springframework.web.servlet.LocaleResolver

public class PrincipalLocaleResolver extends ConfigAwareLocaleResolver
Implementation of ConfigAwareLocaleResolver that extracts the locale from the current authenticated user

Supported configuration properties:

  • attributeName: The name of the attribute to use, defaults to preferredLanguage
Since:
4.0.0
Author:
joseross
  • Field Details

  • Constructor Details

    • PrincipalLocaleResolver

      public PrincipalLocaleResolver()
  • Method Details

    • init

      protected void init(org.apache.commons.configuration2.HierarchicalConfiguration<?> config)
      Description copied from class: ConfigAwareLocaleResolver
      Performs any customization needed
      Specified by:
      init in class ConfigAwareLocaleResolver
      Parameters:
      config - the configuration
    • resolveLocale

      protected Locale resolveLocale(SiteContext siteContext, javax.servlet.http.HttpServletRequest request)
      Description copied from class: ConfigAwareLocaleResolver
      Performs the actual work to resolve a locale
      Specified by:
      resolveLocale in class ConfigAwareLocaleResolver
      Parameters:
      siteContext - the current site context
      request - the current request
      Returns:
      a locale object or null