Class UserPortalLocalizationsHelper


  • public class UserPortalLocalizationsHelper
    extends Object
    • Method Detail

      • createStandardLocales

        public static List<Locale> createStandardLocales​(Locale locale)
        Creates a list of well-known locales, sorted by the display name in the given locale.
        Parameters:
        locale - The locale to use for sorting the locales, based on their display name.
        Returns:
        A list of locales.
      • setCustomPortalMessages

        public static void setCustomPortalMessages​(UserPortalViewModel model)
        Sets the custom portal messages for the user portal view model.
        Parameters:
        model - The user portal view model.
      • setCustomPortalMessagesForLocale

        public static void setCustomPortalMessagesForLocale​(UserPortalViewModel model,
                                                            Locale locale)
        Sets the custom properties for the given locale in the user portal view model. When a property is missing for a locale, it is added with an empty value. At the end, the custom properties for the selected locale are set.
        Parameters:
        model - The user portal view model.
        locale - the locale to set the custom properties for.
      • findCustomSortedPortalMessagesMapForLocale

        public static Map<String,​String> findCustomSortedPortalMessagesMapForLocale​(UserPortalViewModel model,
                                                                                          Locale locale)
        Finds all custom portal messages for the given locale in the user portal view model.
        Parameters:
        model - The user portal view model.
        locale - The locale to find the custom portal messages for.
        Returns:
        A map of custom portal messages.
      • applyLocalizations

        public static void applyLocalizations​(Map<Locale,​LocalizationsViewModel> localizationsModel,
                                              ILocalizationProviding<?,​?> localizationProviding)
        Applies the given localizations model to the given localization providing object.
        Parameters:
        localizationsModel - the localizations model
        localizationProviding - the localization providing object
      • findLanguagesToAddMatchingQuery

        public static List<String> findLanguagesToAddMatchingQuery​(String query,
                                                                   Locale locale,
                                                                   UserPortalViewModel model)
        Finds all languages that match the given query and are not yet added to the user portal. The query is matched against the language tag and the display name of the locale.
        Parameters:
        query - Query to match against the language tags and display names.
        locale - Locale to use for sorting the languages based on their display name.
        model - User portal view model to find the languages for.
        Returns:
        A list of language tags that match the query and are not yet added to the user portal.