|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object info.magnolia.cms.i18n.AbstractI18nContentSupport
public abstract class AbstractI18nContentSupport
An abstract implementation of I18nContentSupport
which stores the
locale specific content in node data having a local suffix:
<name>_<locale>.
The detection of the current locale, based on the URI for instance, is left to the concrete implementation.
Field Summary | |
---|---|
protected Locale |
defaultLocale
If no locale can be determined the default locale will be set. |
Constructor Summary | |
---|---|
AbstractI18nContentSupport()
|
Method Summary | |
---|---|
void |
addLocale(LocaleDefinition ld)
|
Locale |
determineLocale()
Extracts the language from the uri. |
protected static Locale |
determineLocalFromString(String localeStr)
|
Locale |
getDefaultLocale()
|
Locale |
getFallbackLocale()
The default locale to be used. |
Locale |
getLocale()
Get the current locale used for rendering content. |
Collection<Locale> |
getLocales()
Returns the available locales. |
protected Locale |
getNextContentLocale(Locale locale,
Set<Locale> checkedLocales)
Uses getNextLocale(Locale) to find the next locale. |
protected Locale |
getNextLocale(Locale locale)
Returns the closest locale for which isLocaleSupported(Locale) is true. |
NodeData |
getNodeData(Content node,
String name)
Returns the nodedata with the name <name>_<current language> or <name>_<fallback language> otherwise returns <name>. |
NodeData |
getNodeData(Content node,
String name,
Locale locale)
Returns the NodeData object based on the language passes. |
protected boolean |
isEmpty(NodeData nd)
Checks if the nodedata field is empty. |
boolean |
isEnabled()
|
protected boolean |
isLocaleSupported(Locale locale)
|
protected abstract Locale |
onDetermineLocale()
|
void |
setDefaultLocale(Locale defaultLocale)
|
void |
setEnabled(boolean enabled)
|
void |
setFallbackLocale(Locale fallbackLocale)
|
void |
setLocale(Locale locale)
|
String |
toI18NURI(String uri)
Transform the internal uri to a i18n uri. |
protected abstract String |
toI18NURI(String uri,
Locale locale)
|
String |
toRawURI(String i18nURI)
Removes the prefix. |
protected abstract String |
toRawURI(String i18nURI,
Locale locale)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Locale defaultLocale
Constructor Detail |
---|
public AbstractI18nContentSupport()
Method Detail |
---|
public Locale getLocale()
I18nContentSupport
getLocale
in interface I18nContentSupport
public void setLocale(Locale locale)
setLocale
in interface I18nContentSupport
public Locale getFallbackLocale()
I18nContentSupport
getFallbackLocale
in interface I18nContentSupport
public void setFallbackLocale(Locale fallbackLocale)
setFallbackLocale
in interface I18nContentSupport
protected Locale getNextLocale(Locale locale)
isLocaleSupported(Locale)
is true.
public Locale determineLocale()
determineLocale
in interface I18nContentSupport
protected abstract Locale onDetermineLocale()
protected static Locale determineLocalFromString(String localeStr)
public String toI18NURI(String uri)
I18nContentSupport
toI18NURI
in interface I18nContentSupport
protected abstract String toI18NURI(String uri, Locale locale)
public String toRawURI(String i18nURI)
toRawURI
in interface I18nContentSupport
protected abstract String toRawURI(String i18nURI, Locale locale)
public NodeData getNodeData(Content node, String name, Locale locale) throws javax.jcr.RepositoryException
I18nContentSupport
getNodeData
in interface I18nContentSupport
javax.jcr.RepositoryException
public NodeData getNodeData(Content node, String name)
getNodeData
in interface I18nContentSupport
protected Locale getNextContentLocale(Locale locale, Set<Locale> checkedLocales)
getNextLocale(Locale)
to find the next locale. If the returned locale is in the
checkedLocales set it falls back to the fall-back locale. If the fall-back locale itself is
passed to the method, the method returns null to signal the end of the chain.
public boolean isEnabled()
isEnabled
in interface I18nContentSupport
public void setEnabled(boolean enabled)
public Collection<Locale> getLocales()
I18nContentSupport
getLocales
in interface I18nContentSupport
public void addLocale(LocaleDefinition ld)
protected boolean isLocaleSupported(Locale locale)
protected boolean isEmpty(NodeData nd)
public Locale getDefaultLocale()
public void setDefaultLocale(Locale defaultLocale)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |