Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A site in Magnolia may be configured to reflect the locale information provided in the Accept-Language header,  see see DefaultI18nContentSupport and HierarchyBasedI18nContentSupport in the configuration section below.

...

Code Block
/de/tour-type~active~.html

See the section below how to To configure a site in Magnolia to parse Request-URI for locale preference, see RequestLocaleAwareI18nContentSupport in the configuration section below.

Configuring locale for a site

...

Generally, the configuration that defines the locale information for a site is usually keptlocated:

  • In the Enterprise Edition under
    /modules/multisite/config/sites/<site-name>/i18n/locales
  • In the Community Edition under
    /site/config/site/<site-name>/i18n/locales
    In the CE's Travel Demo bundle the configuration is extended from /modules/travel-demo/config/travel .

...

language

Defines the matching language part of the locale, for example the fr part in fr_CH .

country

Defines the matching country part of the locale, for example the CH part in fr_CH .

enabled

true enables the detection for the locale defined under <locale-name> .

class

optionalrequired, default is info.magnolia.cms.i18n.DefaultI18nContentSupport

The class that defines the locale implementation. if the class is not specified, the locale is dependent on the setting in /server/i18n/content .

For the Accept-Language header case:

  • Javadoc resource link
    classNameinfo.magnolia.cms.i18n.RequestLocaleAwareI18nContentSupport
    renderTypeasynchronous
    Reads the locale from the Accept-Language header. This implementation does not render language specific URIs (see the classes below).

For the Request-URI case:

  • Javadoc resource link
    classNameinfo.magnolia.cms.i18n.DefaultI18nContentSupport
    renderTypeasynchronous
    This implementation supports a language prefix like en . To resolve the node data it checks if a node data with the following pattern exists on the content node: <name>_<language> .
  • Javadoc resource link
    classNameinfo.magnolia.cms.i18n.HierarchyBasedI18nContentSupport
    renderTypeasynchronous
    Same as above but for a hierarchy structure, for example:

    Code Block
    my-website
        ├─en
        │  ├─page-1
        │  └─page-n
        ├─de
        │  ├─page-1
        │  └─page-n 
        └─de_CH
           ├─page-1
           └─page-n 

    The locale code can be at whatever position in the URI, not necessarily the first one. For example, /my-website/node-1/node-2/de/home-page.html .

enabled

required, default is false

The switch that enables Enables or disables the locale detection for the siteconfiguration.

defaultLocale

optional

If no locale can be determined this defaultLocale will be set. if not set, the fallbackLocale will be used.

fallbackLocale

requireddefault is en

The content is served for this locale if the content is not available for the current locale or the defaultLocale (if set).