Interface LanguageAlternativesService
-
@ProviderType public interface LanguageAlternativesService
A service that provides access to aPage
's language alternatives.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @Nullable Page
getLanguageAlternative(@NotNull Page page, @NotNull java.util.Locale locale)
Returns the language alternative of a givenPage
in the givenLocale
.@NotNull java.util.Map<java.util.Locale,Page>
getLanguageAlternatives(@NotNull Page page)
Traverses the site subtree of the givenPage
using depth-first-search up to a configured maximum depth and returns language alternatives of the given page in each of the found language roots in the subtree.Page
getSiteRoot(Page page)
Returns the site root as returned by the highest rankedSiteRootSelectionStrategy
for the givenPage
.
-
-
-
Method Detail
-
getSiteRoot
Page getSiteRoot(Page page)
Returns the site root as returned by the highest rankedSiteRootSelectionStrategy
for the givenPage
.- Parameters:
page
- the givenPage
- Returns:
- the site root, or
null
if not found
-
getLanguageAlternative
@Nullable @Nullable Page getLanguageAlternative(@NotNull @NotNull Page page, @NotNull @NotNull java.util.Locale locale)
Returns the language alternative of a givenPage
in the givenLocale
.This is an optimised implementation of
languageAlternativesService.getLanguageAlternative(page).get(locale);
-
getLanguageAlternatives
@NotNull @NotNull java.util.Map<java.util.Locale,Page> getLanguageAlternatives(@NotNull @NotNull Page page)
Traverses the site subtree of the givenPage
using depth-first-search up to a configured maximum depth and returns language alternatives of the given page in each of the found language roots in the subtree. Language roots that are ancestors of other language roots are skipped. For example/content/wknd/fr/fr
is taking precedence over/content/wknd/fr
for whichLocale
derived from the path would be the same.The
Page
's site root is defined by an implementation ofSiteRootSelectionStrategy.getSiteRoot(Page)
.
-
-