Defining locales for a site

Define the languages that editors should be able to choose as locales in the site definition under <site>/i18n/locales.

Example: en, de and cs locales in an example test site definition.

test:
  i18n:
    enabled: true
    class: info.magnolia.cms.i18n.DefaultI18nContentSupport
    fallbackLocale: en
    defaultLocale: cs
    locales:
      cz:
        country: CZ
        language: cs
        enabled: true
      de:
        country: DE
        language: de
        enabled: true

Properties

Property Description

enabled

optional, default is false

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

class

required

Class that implements info.magnolia.cms.i18n.I18nContentSupport such as:

  • Implementations for a site organized into a single tree, in which the locale prefix usually points to the root of a site.

    • info.magnolia.cms.i18n.IetfI18nContentSupport. This is the default implementation, which supports IETF BCP 47 language Tags.

      Example
      test:
        i18n:
          enabled: true
          class: info.magnolia.cms.i18n.IetfI18nContentSupport
          fallbackLocale: en
          defaultLocale: cs
          locales:
            cz:
              languageTag: cs-CZ
              enabled: true
    • info.magnolia.cms.i18n.DefaultI18nContentSupport, which supports a language prefix such as /en/* in the URL and stores localized content in a node using the naming pattern <name><locale>, for example subtitle_en.

      Use this implementation if your site is organized into a single tree, in which the locale prefix usually points to the root of a site.

  • info.magnolia.cms.i18n.HierarchyBasedI18nContentSupport, which stores and serves localized content in a hierarchical structure.

    Use this implementation if your site is organized into multiple trees, in which site roots are usually named after the locales.

  • info.magnolia.cms.i18n.RequestLocaleAwareI18nContentSupport, which reads the locale from the request.

    This implementation does not render language specific URLs.

fallbackLocale

optional, default is en

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

defaultLocale

optional

If no locale can be determined, the default locale will be set. If no default locale is defined, the fallback locale is used.

locales

required

     <locale>

required

An arbitrary locale ID. For example, one that consists of language and country such as zh-TW for traditional Chinese or pt-BR for Brazilian Portuguese.

         country

optional, for configurations using the language property

Country code such as BR for Brazil. See Java 8 locale IDs.

         language

required, unless a configuration with the languageTag property is used

Language code such as pt for Portuguese. See Java 8 locale IDs.

         languageTag

required, unless a configuration with the language property is used

An IETF BCP 47 language tag.

Available since Magnolia 6.2.45.

         enabled

optional, default is false

Enables the locale.

Configure locales for the fallback site

If i18n is enabled in the configuration of your content app, you need to configure locales for the fallback site or extend a site definition with locales.

Then, when editing structured content, the locales of the fallback site will be used while showing the language dropdown.

Feedback

DX Core

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the DX Core docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules