Versions Compared

Key

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

Define the languages that editors should be able to choose as locales the site definition under  <site>/i18n/locales. Each locale has language and country properties. They allow regional variations such as zh_TW for traditional Chinese or pt_BR for Brazilian Portuguese.

Example: Locales en and de in the default site definition

Advanced Tables - Table Plus
heading0
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
Node nameValue

...

 <site>

...

 i18n

...

 locales

...

 en

...

 country   

...

 enabled

...

 language

...

 de

...

 country   

...

 enabled

...

 language

...

Mgnl n
<site>


Mgnl n
i18n


Mgnl n
locales


Mgnl n
en


Mgnl p
country   


Mgnl p
enabled

true

Mgnl p
language

en

Mgnl n
de


Mgnl p
country   


Mgnl p
enabled

true

Mgnl p
language

de

Mgnl p
class

...

info.magnolia.cms.i18n.DefaultI18nContentSupport

...

Mgnl p
enabled

true

...

Mgnl p
fallbackLocale

en

Properties:

locales

required

<locale>

required

Locale name constructed from the language and country such as zh_TW for traditional Chinese or pt_BR for Brazilian Portuguese.

enabled

optional  , default is is false

Enables the locale.

language

required

Language code such as as pt for for Portuguese.  See See Java locale notation  .

country

optional

Country code such as as BR for for Brazil. See See Java locale notation.

class

required

Class that implements I18nContentSupport such implements

Javadoc resource link
0info.magnolia.cms.i18n.I18nContentSupport
classNameinfo.magnolia.cms.i18n.I18nContentSupport
renderTypeasynchronous
such as:

  • info.magnolia.cms.i18n.DefaultI18nContentSupport which which supports a language prefix such as as /en/* in in the URL and and stores localized content in in a node using the naming pattern pattern <name>_<locale>, for example example subtitle_en.
    Use this implementation if your site is organized into into a single tree, in which the locale prefix usually points to the root of a site.

  • info.magnolia.cms.i18n.HierarchyBasedI18nContentSupport which which stores and serves localized content in a hierarchical structure.
    Use this implementation if your site is organized into into multiple trees, in which site roots are usually named after the locales.

  • info.magnolia.cms.i18n.RequestLocaleAwareI18nContentSupport which which reads the locale from the request. This implementation does not render language specific URLs.

enabled

optional  , default is is false

Enables support for localized content. Used to rewrite URIs and getting nodes based on the current language.

fallbackLocale

optional  ,  default is default is en

Content is served for the fallback locale if content is not available for the current locale.