Class LocalizationUtils
- java.lang.Object
-
- com.adobe.cq.wcm.core.components.util.LocalizationUtils
-
public class LocalizationUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description LocalizationUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static @Nullable String
getBlueprintPath(@NotNull Resource resource, @NotNull LiveRelationshipManager relationshipManager)
Returns the path of the blueprint of the resource.static @Nullable String
getLanguageRoot(@NotNull Resource resource, @NotNull LanguageManager languageManager)
Returns the language root of the resource.static @Nullable String
getLiveCopyPath(@NotNull Resource resource, @NotNull LiveRelationshipManager relationshipManager)
Returns the path of the live copy of the resource.static @Nullable String
getLocalizationRoot(@NotNull Resource resource, @NotNull ResourceResolver resolver, @NotNull LanguageManager languageManager, @NotNull LiveRelationshipManager relationshipManager)
Returns the localization root of the given resource.
-
-
-
Method Detail
-
getLocalizationRoot
@Nullable public static @Nullable String getLocalizationRoot(@NotNull @NotNull Resource resource, @NotNull @NotNull ResourceResolver resolver, @NotNull @NotNull LanguageManager languageManager, @NotNull @NotNull LiveRelationshipManager relationshipManager)
Returns the localization root of the given resource.Use case | Resource Path | Root ------------------------------------------|--------------------------------------|------------------ 1. No localization | /content/mysite/mypage | null 2. Language localization | /content/mysite/en/mypage | /content/mysite/en 3. Country-language localization | /content/mysite/us/en/mypage | /content/mysite/us/en 4. Country-language localization (variant)| /content/us/mysite/en/mypage | /content/us/mysite/en 5. Blueprint | /content/mysite/blueprint/mypage | /content/mysite/blueprint 6. Live Copy | /content/mysite/livecopy/mypage | /content/mysite/livecopy
- Parameters:
resource
- the resource for which we want to find the localization rootresolver
- the resource resolverlanguageManager
- the language manager servicerelationshipManager
- the live relationship manager service- Returns:
- the localization root of the resource at the given path if it exists,
null
otherwise
-
getLanguageRoot
@Nullable public static @Nullable String getLanguageRoot(@NotNull @NotNull Resource resource, @NotNull @NotNull LanguageManager languageManager)
Returns the language root of the resource.- Parameters:
resource
- the resourcelanguageManager
- the language manager service- Returns:
- the language root of the resource if it exists,
null
otherwise
-
getBlueprintPath
@Nullable public static @Nullable String getBlueprintPath(@NotNull @NotNull Resource resource, @NotNull @NotNull LiveRelationshipManager relationshipManager)
Returns the path of the blueprint of the resource.- Parameters:
resource
- the resourcerelationshipManager
- the live relationship manager service- Returns:
- the path of the blueprint of the resource if it exists,
null
otherwise
-
getLiveCopyPath
@Nullable public static @Nullable String getLiveCopyPath(@NotNull @NotNull Resource resource, @NotNull @NotNull LiveRelationshipManager relationshipManager)
Returns the path of the live copy of the resource.- Parameters:
resource
- the resourcerelationshipManager
- the live relationship manager service- Returns:
- the path of the live copy of the resource if it exists,
null
otherwise
-
-