Class LocalizationUtils

java.lang.Object
com.adobe.cq.wcm.core.components.util.LocalizationUtils

public class LocalizationUtils extends Object
  • Constructor Details

    • LocalizationUtils

      public LocalizationUtils()
  • Method Details

    • 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 root
      resolver - the resource resolver
      languageManager - the language manager service
      relationshipManager - 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 resource
      languageManager - 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 resource
      relationshipManager - 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 resource
      relationshipManager - the live relationship manager service
      Returns:
      the path of the live copy of the resource if it exists, null otherwise