Interface ILocalizationManager

  • All Known Implementing Classes:
    LocalizationManager

    @StableMinor(version="14.0",
                 sinceVersion="4.2")
    public interface ILocalizationManager
    Manager responsible for string localization and locales
    Since:
    4.0.0
    Version:
    $Revision: 24477 $ $Date: 2021-04-28 11:30:36 -0300 (Wed, 28 Apr 2021) $
    • Method Detail

      • getLocales

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

        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​(String id)
             throws PortalException
        Deletes the locale with the given identifier.
        Parameters:
        id - the locale identifier.
        Throws:
        PortalException
        Since:
        8.1.0
      • localize

        String localize​(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

        String localize​(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

        String localize​(String id,
                        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

        String localize​(String id,
                        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

        String localize​(String id,
                        IResource resource,
                        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

        String localize​(String id,
                        IResource resource,
                        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

        String localize​(String id,
                        List<IResource> resources,
                        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

        String localize​(String id,
                        List<IResource> resources,
                        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​(String resourcePath)
                 throws PortalException
        Clear the localization cache by passing the resource path.
        Parameters:
        resourcePath -
        Throws:
        PortalException
      • clearCache

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