Class CmsLocaleGroup

java.lang.Object
org.opencms.i18n.CmsLocaleGroup

public class CmsLocaleGroup extends Object
Represents a group of resources which are locale variants of each other.

  • Constructor Details

    • CmsLocaleGroup

      public CmsLocaleGroup(CmsObject cms, CmsResource primaryResource, List<CmsResource> secondaryResources)
      Creates a new instance.

      Parameters:
      cms - the CMS context to use
      primaryResource - the primary resource
      secondaryResources - the secondary resources
  • Method Details

    • getAllResources

      Gets the list of all resources of this group (primary and secondary).

      Returns:
      the list of all resources of this group
    • getMainLocale

      Gets the main locale (i.e. the locale of the primary resource of this group).

      Returns:
      the main locale
    • getPrimaryResource

      Gets the primary resource.

      Returns:
      the primary resource
    • getResourcesByLocale

      Gets a map which contains the resources of the locale group as keys, indexed by their locale.

      If the locale group contains more than one resource from the same locale,, which one is used a map value is undefined.

      Returns:
      the map of resources by locale
    • getResourcesForLocale

      Gets the resources of this group which have the given locale.

      Parameters:
      locale - a locale
      Returns:
      the collection of resources with the given locale
    • getSecondaryResources

      Gets the secondary resources of this group.

      Returns:
      the collection of secondary resources
    • hasLocale

      public boolean hasLocale(Locale locale)
      Checks if this group has a resource with the given locale.

      Parameters:
      locale - the locale
      Returns:
      true if the group has a resource with the locale
    • isMarkedNoTranslation

      public boolean isMarkedNoTranslation(Locale locale)
      Checks if the locale group is marked as not translatable for the given locale.

      Parameters:
      locale - a locale
      Returns:
      true if the locale group is marked as not translatable for the given locale
    • isMarkedNoTranslation

      public boolean isMarkedNoTranslation(Set<Locale> locales)
      Checks if the locale group is marked as not translatable for any of the given locales.

      Parameters:
      locales - a set of locales
      Returns:
      true if the locale group is marked as not translatable for any of the given resources
    • isPotentialGroupHead

      public boolean isPotentialGroupHead()
      Returns true if this is a potential group head, i.e. the locale of the primary resource is the main translation locale configured for the site in which it is located.

      Returns:
      true if this is a potential group head
    • isRealGroup

      public boolean isRealGroup()
      Checks if this group is a real group, i.e. consists of more than one resource.

      Returns:
      true if this is a real group
    • isRealGroupOrPotentialGroupHead

      Checks if this is either a real group or a potential group head (i.e. a potential primary resource).

      Returns:
      true if this is a real group or a potential group head