Class HierarchyBasedI18nContentSupport

  extended by info.magnolia.cms.i18n.AbstractI18nContentSupport
      extended by info.magnolia.cms.i18n.HierarchyBasedI18nContentSupport
All Implemented Interfaces:

public class HierarchyBasedI18nContentSupport
extends AbstractI18nContentSupport

Serves i18n content found in a per locale hierarchy structure. E.g.

  + en
   + page-1
   + page-2
   + page-n
  + de
   + page-1
   + page-2
   + page-n
  + de_CH
   + page-1
   + page-2
   + page-n
  + it
   + page-1
   + page-2
   + page-n
The locale is inferred by analyzing the URI and checking whether it contains a valid Java locale code (see definition of valid Java locale code). This code can be at whatever position in the URI, not necessarily the first one. For example, given the following URI /my-website/node-1/node-2/de/home-page.html, the locale de will be detected and content served from here:
 + my-website
  + node-1
   + node-2
    + de
     + home-page
Also the last element in the URI, typically a page, can be used to determine the locale. E.g. given the URI /foo/bar/it.html a it locale will be determined. If no locale is found in the URI, the default one is assumed.


Field Summary
Fields inherited from class info.magnolia.cms.i18n.AbstractI18nContentSupport
Constructor Summary
Method Summary
 NodeData getNodeData(Content node, String name)
          Returns the nodedata with the name <name>_<current language> or <name>_<fallback language> otherwise returns <name>.
protected  Locale onDetermineLocale()
protected  String toI18NURI(String uri, Locale locale)
protected  String toRawURI(String i18nURI, Locale locale)
Methods inherited from class info.magnolia.cms.i18n.AbstractI18nContentSupport
addLocale, determineLocale, determineLocalFromString, getDefaultLocale, getFallbackLocale, getLocale, getLocales, getNextContentLocale, getNextLocale, getNodeData, isEmpty, isEnabled, isLocaleSupported, setDefaultLocale, setEnabled, setFallbackLocale, setLocale, toI18NURI, toRawURI
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public HierarchyBasedI18nContentSupport()
Method Detail


protected Locale onDetermineLocale()
Specified by:
onDetermineLocale in class AbstractI18nContentSupport


protected String toI18NURI(String uri,
                           Locale locale)
Specified by:
toI18NURI in class AbstractI18nContentSupport


protected String toRawURI(String i18nURI,
                          Locale locale)
Specified by:
toRawURI in class AbstractI18nContentSupport


public NodeData getNodeData(Content node,
                            String name)
Description copied from class: AbstractI18nContentSupport
Returns the nodedata with the name <name>_<current language> or <name>_<fallback language> otherwise returns <name>.

Specified by:
getNodeData in interface I18nContentSupport
getNodeData in class AbstractI18nContentSupport

Copyright © 2003-2012 Magnolia International Ltd.. All Rights Reserved.