Package org.opencms.i18n
Class CmsLocaleGroup
java.lang.Object
org.opencms.i18n.CmsLocaleGroup
Represents a group of resources which are locale variants of each other.
-
Constructor Summary
ConstructorDescriptionCmsLocaleGroup
(CmsObject cms, CmsResource primaryResource, List<CmsResource> secondaryResources) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionGets the list of all resources of this group (primary and secondary).Gets the main locale (i.e.Gets the primary resource.Gets a map which contains the resources of the locale group as keys, indexed by their locale.getResourcesForLocale
(Locale locale) Gets the resources of this group which have the given locale.Gets the secondary resources of this group.boolean
Checks if this group has a resource with the given locale.boolean
isMarkedNoTranslation
(Locale locale) Checks if the locale group is marked as not translatable for the given locale.boolean
isMarkedNoTranslation
(Set<Locale> locales) Checks if the locale group is marked as not translatable for any of the given locales.boolean
Returns true if this is a potential group head, i.e.boolean
Checks if this group is a real group, i.e.boolean
Checks if this is either a real group or a potential group head (i.e.
-
Constructor Details
-
CmsLocaleGroup
public CmsLocaleGroup(CmsObject cms, CmsResource primaryResource, List<CmsResource> secondaryResources) Creates a new instance.- Parameters:
cms
- the CMS context to useprimaryResource
- the primary resourcesecondaryResources
- 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
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
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
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
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
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
-