Interface ILocalizationManager

  • All Known Implementing Classes:
    LocalizationManager

    @StableMinor(version="15.0",
                 sinceVersion="4.2")
    public interface ILocalizationManager
    Manager responsible for string localization and locales
    Since:
    4.0.0
    Version:
    $Revision: 25303 $ $Date: 2022-10-22 22:48:02 -0300 (Sat, 22 Oct 2022) $
    • Field Detail

      • DO_NOT_RENDER_PARAMETERS

        static final java.lang.String DO_NOT_RENDER_PARAMETERS
        See Also:
        Constant Field Values
    • Method Detail

      • getLocales

        java.util.Collection<LocaleConfig> getLocales​(ITransaction transaction)
                                               throws PortalException
        Returns the available locales for the portal.
        Parameters:
        transaction - the transaction for persistence access.
        Returns:
        A collection with the available locales.
        Throws:
        PortalException
        Since:
        4.0.10
      • getLocales

        java.util.Collection<java.util.Locale> getLocales()
        Returns all locales currently available in the portal.
        Returns:
        locales available in the portal.
        Since:
        8.1.0
      • getDefaultLocale

        java.util.Locale getDefaultLocale()
        Returns the portal default locale. The global portal default locale is assumed to be the default locale of the portal root channel.
        Returns:
        the portal default locale.
        Since:
        8.1.0
      • delete

        void delete​(java.lang.String id)
             throws PortalException
        Deletes the locale with the given identifier.
        Parameters:
        id - the locale identifier.
        Throws:
        PortalException
        Since:
        8.1.0
      • localize

        java.lang.String localize​(java.lang.String id,
                                  IResource resource)
                           throws PortalException
        Localizes the given string id using the given resource and current locale.

        If no localized value is found for the given id, the id itself is returned.
        If the string id passed in is null, the return value will also be null.

        To take into account localizations from themes, use localize(String, IResource, PageWebResource).
        Parameters:
        id - The string id to localize
        resource - The resource to search for localizations
        Returns:
        The localized string
        Or the received string id when no localization was found. If the passed id is null, null is also returned.
        Throws:
        PortalException
      • localize

        java.lang.String localize​(java.lang.String id,
                                  IResource resource,
                                  PageWebResource pageWebResource)
                           throws PortalException
        Localizes the given string id using the given resource, PageWebResource and current locale.

        If no localized value is found for the given id, the id itself is returned.
        If the string id passed in is null, the return value will also be null.

        Parameters:
        id - The string id to localize
        resource - The resource to search for localizations
        pageWebResource - The PageWebResource used to search for localizations within themes.
        Returns:
        The localized string
        Or the received string id when no localization was found. If the passed id is null, null is also returned.
        Throws:
        PortalException
      • localize

        java.lang.String localize​(java.lang.String id,
                                  java.util.List<IResource> resources)
                           throws PortalException
        Localizes the given string id using the given resources and current locale.

        If no localized value is found for the given id, the id itself is returned.
        If the string id passed in is null, the return value will also be null.

        To take into account localizations from themes, use localize(String, List, PageWebResource).
        Parameters:
        id - The string id to localize
        resources - The resources to search for localizations
        Returns:
        The localized string
        Or the received string id when no localization was found. If the passed id is null, null is also returned.
        Throws:
        PortalException
      • localize

        java.lang.String localize​(java.lang.String id,
                                  java.util.List<IResource> resources,
                                  PageWebResource pageWebResource)
                           throws PortalException
        Localizes the given string id using the given resources, PageWebResource and current locale.

        If no localized value is found for the given id, the id itself is returned.
        If the string id passed in is null, the return value will also be null.

        Parameters:
        id - The string id to localize
        resources - The resources to search for localizations
        pageWebResource - The PageWebResource used to search for localizations within themes.
        Returns:
        The localized string
        Or the received string id when no localization was found. If the passed id is null, null is also returned.
        Throws:
        PortalException
      • localize

        java.lang.String localize​(java.lang.String id,
                                  IResource resource,
                                  java.util.Locale locale)
                           throws PortalException
        Localizes the given string id using the given resource and locale.

        If no localized value is found for the given id, the id itself is returned.
        If the string id passed in is null, the return value will also be null.

        To take into account localizations from themes, use #localize(String, IResource, Locale, PageWebResource) .
        Parameters:
        id - The string id to localize
        resource - The resource to search for localizations
        locale - The locale to use for localization
        Returns:
        The localized string
        Or the received string id when no localization was found. If the passed id is null, null is also returned.
        Throws:
        PortalException
      • localize

        java.lang.String localize​(java.lang.String id,
                                  IResource resource,
                                  java.util.Locale locale,
                                  WebResource webResource)
                           throws PortalException
        Localizes the given string id using the given resource, WebResource and locale.

        If no localized value is found for the given id, the id itself is returned.
        If the string id passed in is null, the return value will also be null.

        Parameters:
        id - The string id to localize
        resource - The resources to search for localizations
        locale - The locale to use for localization
        webResource - The WebResource used to search for localizations within themes.
        Returns:
        The localized string
        Or the received string id when no localization was found. If the passed id is null, null is also returned.
        Throws:
        PortalException
      • localize

        java.lang.String localize​(java.lang.String id,
                                  java.util.List<IResource> resources,
                                  java.util.Locale locale)
                           throws PortalException
        Localizes the given string id using the given resources and locale.

        If no localized value is found for the given id, the id itself is returned.
        If the string id passed in is null, the return value will also be null.

        To take into account localizations from themes, use #localize(String, List, Locale, PageWebResource).
        Parameters:
        id - The string id to localize
        resources - The resources to search for localizations
        locale - The locale to use for localization
        Returns:
        The localized string
        Or the received string id when no localization was found. If the passed id is null, null is also returned.
        Throws:
        PortalException
      • localize

        java.lang.String localize​(java.lang.String id,
                                  java.util.List<IResource> resources,
                                  java.util.Locale locale,
                                  WebResource pageWebResource)
                           throws PortalException
        Localizes the given string id using the given resources, WebResource and locale.

        If no localized value is found for the given id, the id itself is returned.
        If the string id passed in is null, the return value will also be null.

        Parameters:
        id - The string id to localize
        resources - The resources to search for localizations
        locale - The locale to use for localization
        webResource - The WebResource used to search for localizations within themes.
        Returns:
        The localized string
        Or the received string id when no localization was found. If the passed id is null, null is also returned.
        Throws:
        PortalException
      • clearCache

        void clearCache​(java.lang.String resourcePath)
                 throws PortalException
        Clear the localization cache by passing the resource path.
        Parameters:
        resourcePath -
        Throws:
        PortalException
      • clearCache

        void clearCache​(java.lang.String resourcePath,
                        java.util.Locale locale)
                 throws PortalException
        Clear the localization cache by passing the resource path and the locale.
        Parameters:
        resourcePath -
        locale -
        Throws:
        PortalException
      • getCachedResourcePaths

        @Deprecated
        java.lang.Iterable<java.lang.String> getCachedResourcePaths()
                                                             throws ManagerException
        Deprecated.
        Since 8.1.0, this method is no longer available and always returns an empty iterable.
        Get the keys for all cached items
        Returns:
        Throws:
        ManagerException
      • deleteCustomString

        void deleteCustomString​(SessionConfig sessionConfig,
                                java.lang.String customStringId,
                                ITransaction transaction)
                         throws PortalException
        Delete a specified Custom String
        Parameters:
        sessionConfig -
        customStringId -
        transaction -
        Throws:
        PortalException