|
||||||||||
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 java.util.Locale |
defaultLocale
If no locale can be determined the default locale will be set. |
Constructor Summary | |
---|---|
AbstractI18nContentSupport()
|
Method Summary | |
---|---|
void |
addLocale(LocaleDefinition ld)
|
java.util.Locale |
determineLocale()
Extracts the language from the uri. |
protected static java.util.Locale |
determineLocalFromString(java.lang.String localeStr)
|
java.util.Locale |
getDefaultLocale()
|
java.util.Locale |
getFallbackLocale()
The default locale to be used. |
java.util.Locale |
getLocale()
Get the current locale used for rendering content. |
java.util.Collection<java.util.Locale> |
getLocales()
Returns the available locales. |
protected java.util.Locale |
getNextContentLocale(java.util.Locale locale,
java.util.Set<java.util.Locale> checkedLocales)
Uses getNextLocale(Locale) to find the next locale. |
protected java.util.Locale |
getNextLocale(java.util.Locale locale)
Returns the closest locale for which isLocaleSupported(Locale) is true. |
NodeData |
getNodeData(Content node,
java.lang.String name)
Returns the nodedata with the name <name>_<current language> or <name>_<fallback language> otherwise returns <name>. |
NodeData |
getNodeData(Content node,
java.lang.String name,
java.util.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(java.util.Locale locale)
|
protected abstract java.util.Locale |
onDetermineLocale()
|
void |
setDefaultLocale(java.util.Locale defaultLocale)
|
void |
setEnabled(boolean enabled)
|
void |
setFallbackLocale(java.util.Locale fallbackLocale)
|
void |
setLocale(java.util.Locale locale)
|
java.lang.String |
toI18NURI(java.lang.String uri)
Transform the internal uri to a i18n uri. |
protected abstract java.lang.String |
toI18NURI(java.lang.String uri,
java.util.Locale locale)
|
java.lang.String |
toRawURI(java.lang.String i18nURI)
Removes the prefix. |
protected abstract java.lang.String |
toRawURI(java.lang.String i18nURI,
java.util.Locale locale)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Locale defaultLocale
Constructor Detail |
---|
public AbstractI18nContentSupport()
Method Detail |
---|
public java.util.Locale getLocale()
I18nContentSupport
getLocale
in interface I18nContentSupport
public void setLocale(java.util.Locale locale)
setLocale
in interface I18nContentSupport
public java.util.Locale getFallbackLocale()
I18nContentSupport
getFallbackLocale
in interface I18nContentSupport
public void setFallbackLocale(java.util.Locale fallbackLocale)
setFallbackLocale
in interface I18nContentSupport
protected java.util.Locale getNextLocale(java.util.Locale locale)
isLocaleSupported(Locale)
is true.
public java.util.Locale determineLocale()
determineLocale
in interface I18nContentSupport
protected abstract java.util.Locale onDetermineLocale()
protected static java.util.Locale determineLocalFromString(java.lang.String localeStr)
public java.lang.String toI18NURI(java.lang.String uri)
I18nContentSupport
toI18NURI
in interface I18nContentSupport
protected abstract java.lang.String toI18NURI(java.lang.String uri, java.util.Locale locale)
public java.lang.String toRawURI(java.lang.String i18nURI)
toRawURI
in interface I18nContentSupport
protected abstract java.lang.String toRawURI(java.lang.String i18nURI, java.util.Locale locale)
public NodeData getNodeData(Content node, java.lang.String name, java.util.Locale locale) throws javax.jcr.RepositoryException
I18nContentSupport
getNodeData
in interface I18nContentSupport
javax.jcr.RepositoryException
public NodeData getNodeData(Content node, java.lang.String name)
getNodeData
in interface I18nContentSupport
protected java.util.Locale getNextContentLocale(java.util.Locale locale, java.util.Set<java.util.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 java.util.Collection<java.util.Locale> getLocales()
I18nContentSupport
getLocales
in interface I18nContentSupport
public void addLocale(LocaleDefinition ld)
protected boolean isLocaleSupported(java.util.Locale locale)
protected boolean isEmpty(NodeData nd)
public java.util.Locale getDefaultLocale()
public void setDefaultLocale(java.util.Locale defaultLocale)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |