@ProviderType public interface LanguageManager
Modifier and Type | Interface and Description |
---|---|
static interface |
LanguageManager.Info
Information about a resource in a language tree.
|
static interface |
LanguageManager.Tree
Encapsulates information about language specific existences of resources
in a tree.
|
static interface |
LanguageManager.TreeNode
Denotes a node in the tree.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
IS_LANGUAGE_ROOT_PROP_NAME
relative path of the language root property of a hierarchy node.
|
static java.lang.String |
ISO_PROP_NAME
relative path of the language property of a hierarchy node.
|
Modifier and Type | Method and Description |
---|---|
LanguageManager.Tree |
compareLanguageTrees(ResourceResolver resolver,
java.lang.String path)
Compares language trees using the language of the page at the given path
as main language.
|
java.util.Map<java.util.Locale,LanguageManager.Info> |
getAdjacentInfo(ResourceResolver resolver,
java.lang.String path)
Deprecated.
|
java.util.Map<Language,LanguageManager.Info> |
getAdjacentLanguageInfo(ResourceResolver resolver,
java.lang.String path)
Returns a map of language information for each
language filled with information if respective hierarchy or content exists
for that language.
|
Language |
getCqLanguage(Resource res)
Returns the language for the given resource.
|
Language |
getCqLanguage(Resource res,
boolean respectContent)
Returns the language for the given resource.
|
java.util.Collection<Language> |
getCqLanguages(ResourceResolver resolver,
java.lang.String path)
Returns a collection of root languages for the given page.
|
java.lang.String |
getIsoCountry(java.util.Locale language)
Returns the country iso code for the given locale.
|
java.util.Locale |
getLanguage(Resource res)
Returns the language for the given resource.
|
java.util.Locale |
getLanguage(Resource res,
boolean respectContent)
Returns the language for the given resource.
|
Page |
getLanguageRoot(Resource res)
Returns the language root page for the given resource.
|
Page |
getLanguageRoot(Resource res,
boolean respectContent)
Returns the language root page for the given resource.
|
Resource |
getLanguageRootResource(Resource res)
Returns the language root resource for the given resource.
|
Resource |
getLanguageRootResource(Resource res,
boolean respectContent)
Returns the language root resource for the given resource.
|
java.util.Collection<Resource> |
getLanguageRootResources(ResourceResolver resolver,
java.lang.String path)
Returns a collection of
Resource objects which act as language roots for the resource at the given path. |
java.util.Collection<Resource> |
getLanguageRootResources(ResourceResolver resolver,
java.lang.String path,
boolean respectContent)
Returns a collection of
Resource objects which act as language
roots for the resource at the given path. |
java.util.Collection<Page> |
getLanguageRoots(ResourceResolver resolver,
java.lang.String path)
Returns a collection of language root pages for the given page.
|
java.util.Collection<java.util.Locale> |
getLanguages(ResourceResolver resolver,
java.lang.String path)
Deprecated.
use
getCqLanguages(ResourceResolver, String) instead. |
static final java.lang.String ISO_PROP_NAME
static final java.lang.String IS_LANGUAGE_ROOT_PROP_NAME
java.lang.String getIsoCountry(java.util.Locale language)
language
- the language locale to retrieve the country fromjava.util.Map<java.util.Locale,LanguageManager.Info> getAdjacentInfo(ResourceResolver resolver, java.lang.String path)
getAdjacentLanguageInfo(ResourceResolver, String)
insteadresolver
- resource resolverpath
- path to checknull
if the given path does not
reside on or below a language root.LanguageUtil.getLanguageRoot(String)
java.util.Map<Language,LanguageManager.Info> getAdjacentLanguageInfo(ResourceResolver resolver, java.lang.String path)
resolver
- resource resolverpath
- path to checknull
if the given path does not
reside on or below a language root.LanguageUtil.getLanguageRoot(String)
java.util.Locale getLanguage(Resource res)
res
- resourcenull
if not determinableLanguage getCqLanguage(Resource res)
res
- resourcenull
if not determinablejava.util.Locale getLanguage(Resource res, boolean respectContent)
null
is returned unless respectContent
is
true
. then the resources ancestors (including the given)
one is searched for a ISO_PROP_NAME
property.res
- resourcerespectContent
- if false
only the path is analyzednull
if not determinableLanguage getCqLanguage(Resource res, boolean respectContent)
null
is returned unless respectContent
is
true
. then the resources ancestors (including the given)
one is searched for a ISO_PROP_NAME
property.res
- resourcerespectContent
- if false
only the path is analyzednull
if not determinablePage getLanguageRoot(Resource res)
res
- resourcenull
if not determinable@Nullable Page getLanguageRoot(Resource res, boolean respectContent)
respectContent
is true
, then the resources ancestors (including
the given one) are searched for a IS_LANGUAGE_ROOT_PROP_NAME
property. If the property is true
, ISO_PROP_NAME
is used to determine language root. If the IS_LANGUAGE_ROOT_PROP_NAME
property is false
or the ISO_PROP_NAME
property is not
found or respectContent
is false
, the path of the
resource is analyzed to find a matching iso code. If no iso code can be found,
null
is returned.res
- resourcerespectContent
- if false
only the path is analyzednull
if not determinableResource getLanguageRootResource(Resource res)
res
- the resourcenull
if not determinable@Nullable Resource getLanguageRootResource(Resource res, boolean respectContent)
respectContent
are true
, then the resources ancestors (including
the given one) is searched for a IS_LANGUAGE_ROOT_PROP_NAME
property. If the property is true
, ISO_PROP_NAME
is used to determine language root. If the IS_LANGUAGE_ROOT_PROP_NAME
property is false
or the ISO_PROP_NAME
property is not
found or respectContent
is false
, the path of the
resource is analyzed to find a matching iso code. If no iso code can be found,
null
is returned.res
- the resourcerespectContent
- if false
only the path is analyzednull
if not determinablejava.util.Collection<java.util.Locale> getLanguages(ResourceResolver resolver, java.lang.String path)
getCqLanguages(ResourceResolver, String)
instead.resolver
- resource resolverpath
- path of the current pagejava.util.Collection<Language> getCqLanguages(ResourceResolver resolver, java.lang.String path)
resolver
- resource resolverpath
- path of the current pagejava.util.Collection<Page> getLanguageRoots(ResourceResolver resolver, java.lang.String path)
resolver
- resource resolverpath
- path of the current pagejava.util.Collection<Resource> getLanguageRootResources(ResourceResolver resolver, java.lang.String path)
Resource
objects which act as language roots for the resource at the given path.resolver
- a ResourceResolver
used to access the repositorypath
- the path of the current pagejava.util.Collection<Resource> getLanguageRootResources(ResourceResolver resolver, java.lang.String path, boolean respectContent)
Resource
objects which act as language
roots for the resource at the given path. For example, consider the
following structure where language roots would be searched a level up or down.
/content/example/language-masters +-- en +-- emea | +-- de | +-- fr +-- apac | +-- ko | +-- zh-cnIf
respectContent
is true
, then the resources ancestors (including the
given one) are searched for a IS_LANGUAGE_ROOT_PROP_NAME
property. If the
property is true
, ISO_PROP_NAME
is used to determine language root.
If the IS_LANGUAGE_ROOT_PROP_NAME
property is false
or the
ISO_PROP_NAME
property is not found or respectContent
is false
,
the path of the resource is analyzed to find a matching iso code. Implementation may
choose to optimize for certain type of hierarchies.resolver
- a ResourceResolver
used to access the repositorypath
- the path of the current pagerespectContent
- if false
only the path is analyzedLanguageManager.Tree compareLanguageTrees(ResourceResolver resolver, java.lang.String path)
resolver
- resource resolvedpath
- path to resource to start fromCopyright © 2010 - 2020 Adobe. All Rights Reserved