...
To configure a site in Magnolia to parse Request-URI
for locale preference, see DefaultI18nContentSupport
and HierarchyBasedI18nContentSupport
in the configuration section below.
The I18nContentSupport interface
A key role in deciding which approach to apply to determine the preferred public locale is played by the
Javadoc resource link |
---|
className | info.magnolia.cms.i18n.I18nContentSupport |
---|
renderType | asynchronous |
---|
|
interface. Its configuration is stored under /server/i18n/content
. The entry point to this interface is via the Javadoc resource link |
---|
className | info.magnolia.cms.i18n.I18nContentSupportFilter |
---|
renderType | asynchronous |
---|
|
, usually set in /server/filters/i18n
. The I18nContentSupport
interface has the following implementations: Javadoc resource link |
---|
className | info.magnolia.cms.i18n.AbstractI18nContentSupport |
---|
renderType | asynchronous |
---|
|
, an abstract implementation 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 oane of the following three implementations. Javadoc resource link |
---|
className | info.magnolia.cms.i18n.RequestLocaleAwareI18nContentSupport |
---|
renderType | asynchronous |
---|
|
(relevant to the Accept-Language header case) Reads the locale from the Accept-Language header. This implementation does not render language specific URIs (see the classes below). Javadoc resource link |
---|
className | info.magnolia.cms.i18n.DefaultI18nContentSupport |
---|
renderType | asynchronous |
---|
|
(relevant to the Request-URI case described above). Used in the Magnolia Travel Demo, this implementation supports a language prefix in the URI, such as de
for example. It checks if a node data with the <name>_<language>
pattern exists on a content node:
Image Added
Javadoc resource link |
---|
className | info.magnolia.cms.i18n.HierarchyBasedI18nContentSupport |
---|
renderType | asynchronous |
---|
|
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
.
Configuring locale for a site
...
language
| required The minimum locale specification if the resolution of locale set under <locale-name> is enabled. Defines the language part of the locale parameter, for example uk for Ukrainian . For additional language codes see https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry. |
country
| optional Defines the regional variant of the locale parameter, for example GB for the United Kingdom . For additinal country codes see https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry . |
enabled
| required true enables the detection of locale for the configuration defined under <locale-name> . |
class | required, 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 |
---|
className | info.magnolia.cms.i18n.RequestLocaleAwareI18nContentSupport |
---|
renderType | asynchronous |
---|
| 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 |
---|
className | info.magnolia.cms.i18n.DefaultI18nContentSupport |
---|
renderType | asynchronous |
---|
| Used in the Magnolia Travel Demo, this implementation supports a language prefix in the URI, such as de for example. It checks if a node data with the <name>_<language> pattern exists on a content node:Image Removed Javadoc resource link |
---|
className | info.magnolia.cms.i18n.HierarchyBasedI18nContentSupport |
---|
renderType | asynchronous |
---|
| 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 Enables or disables the locale configuration. |
defaultLocale | optional If no locale can be determined, this defaultLocale will be set. If unset, the fallbackLocale will be used. |
fallbackLocale | required, default is en The content is served for this locale if the content is not available for the current locale or the defaultLocale (if set). |