Class UserPortalLocaleManager

  • All Implemented Interfaces:
    Serializable

    @Named
    @SessionScoped
    public class UserPortalLocaleManager
    extends Object
    implements Serializable
    Session-scoped manager for the current locale of the user portal.
    Since:
    8.2.0
    See Also:
    Serialized Form
    • Constructor Detail

      • UserPortalLocaleManager

        public UserPortalLocaleManager()
    • Method Detail

      • getLocale

        public Locale getLocale()
        Gets the current locale for the user portal frontend.
        Returns:
        The current locale.
      • setLocale

        public void setLocale​(Locale locale)
        Alias for #setRequestedLocale(Locale), intended to be used in facelet pages as an EL value binding.
        Parameters:
        locale - The locale to set.
      • getSupportedLocales

        public Set<Locale> getSupportedLocales()
        Gets a set of the supported locales for the user portal frontend, i.e. the locales from which the user can select one.
        Returns:
        The supported locales.
      • getSupportedLocalesSorted

        public List<Locale> getSupportedLocalesSorted()
        Gets a sorted list with the supported locales for the user portal frontend, i.e. the locales from which the user can select one.
        Returns:
        The supported locales.
      • setRequestedLocale

        public void setRequestedLocale​(Locale requestedLocale)
        Sets the locale that was requested, which may not be the current locale and may not be part of the currently supported locales.
        Parameters:
        requestedLocale - The requested locale.
      • setSupportedLocalesForPortal

        public void setSupportedLocalesForPortal​(String portalAlias,
                                                 Collection<Locale> supportedLocales)
        Set the supported locales for a given user portal.
        Parameters:
        portalAlias - The portal alias.
        supportedLocales - The supported locales.
      • isLocaleSelected

        public boolean isLocaleSelected​(Locale locale)
        Checks whether the given locale is selected.
        Parameters:
        locale - The locale to check.
        Returns:
        true if the given locale is selected, false otherwise.
      • getPrimeFacesLocaleLanguage

        public String getPrimeFacesLocaleLanguage()
        Gets the language of the PrimeFaces locale file that should be loaded for the current locale. PrimeFaces uses its English ARIA labels, e.g. for the paginator or for closing an overlay, unless a locale file for the current language was loaded. As PrimeFaces does not ship a locale file for every language, English is reported for a language without a locale file.
        Returns:
        The language of the PrimeFaces locale file to load, never null.
        Since:
        8.6.0