Language configuration
Magnolia CMS provides comprehensive multilanguage support for both the AdminCentral interface and website content. Key features include:
-
System language configuration
-
User interface language preferences
-
Multilanguage content creation and management
-
Content storage and URL strategies for localized content
-
UTF-8 support for international character sets
Language configuration operates at multiple levels, from individual user preferences to system-wide settings and site-specific configurations. Understanding these different aspects helps you implement an effective multilanguage strategy for your Magnolia projects.
Configure system languages
Magnolia supports multiple system languages for the administration interface and other system components.
Available system languages
System languages are configured in Configuration >
/server/i18n/system
. Each locale has language
and country
properties that define the locale when combined. This allows you to
define regional variations such as zh-TW
for traditional Chinese or
pt-BR
for Brazilian Portuguese.
server: i18n: system: fallbackLanguage: en languages: en: country: enabled: true language: en pt: country: enabled: true language: pt pt_BR: country: BR enabled: true language: pt zh_CN: country: CN enabled: true language: zh zh_TW: country: TW enabled: true language: zh
Configure user interface language preferences
Magnolia allows users to set their preferred language for the user interface. This setting is stored in the user profile and applies to the AdminCentral interface.
Set an editor’s language preference
To set a user’s language preference:
-
Open the Security app (Apps > Security).
-
Select the user profile you wish to edit.
-
Click Edit user.
-
Select a language from the Language dropdown.
When the user signs in the next time, the UI is displayed in their preferred language. |
Set up multilanguage content
This section explains how to enable and configure multilanguage content for your website.
Enable multilanguage content
To enable multilanguage content:
-
Configure the
I18NAuthoringSupport
implementation to support multilanguage editing. See Configure I18nAuthoringSupport. -
Set
i18n: true
in form fields to allow multilanguage content entry. See Set i18n to true in form fields. -
Set
i18n: true
in content type properties for multilanguage content types. See Set i18n to true in content type properties. -
Define locales in the site configuration to specify available languages. See Define locales for the site.
Configure I18nAuthoringSupport
In Magnolia 6.3, the I18NAuthoringSupport
interface, which controls multilanguage authoring, is configured in a module descriptor instead of JCR at /server/i18n/authoring
.
For example, the magnolia-module-multisite-jcr
module defines:
<component>
<type>info.magnolia.ui.api.i18n.I18NAuthoringSupport</type>
<implementation>info.magnolia.multisite.i18n.MultiSiteI18nAuthoringSupport</implementation>
<scope>singleton</scope>
</component>
If you use Live Copy, you can override this configuration with info.magnolia.livecopy.i18n.I18NAuthoringSupportProvider , which by default resolves to MultiSiteI18nAuthoringSupport .
See the Live copy internationalization page for more details.
|
To override this with a custom implementation (for example, extending MultiSiteI18nAuthoringSupport
to define locales based on a node path), add it to your project module’s descriptor:
<component>
<type>info.magnolia.ui.api.i18n.I18NAuthoringSupport</type>
<implementation>com.custom.i18n.CustomI18nAuthoringSupport</implementation>
<scope>singleton</scope>
</component>
Before Magnolia 6.3, you could override
See Upgrading to Magnolia 6.3 for more information. |
Set i18n to true in form fields
Set the i18n
property to true
in all fields where you want to enter multilanguage content.
Example: Multilanguage content is enabled for the title
text field.
form:
properties:
title:
$type: textField
i18n: true
Set i18n to true in content type properties
Add the i18n
property with the true
value to all content type model properties where you want to enter multilanguage content.
Example: The text field description
is enabled for multilanguage content entry.
datasource:
$type: jcrContentTypeDatasource
workspace: tourvehicles
autoCreate: true
model:
properties:
- name: description
i18n: true
Define locales for the 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 | ||
---|---|---|---|
|
optional, default is Enables support for localized content. Used to rewrite URIs and getting nodes based on the current language. |
||
|
required Class that implements info.magnolia.cms.i18n.I18nContentSupport such as:
|
||
|
optional, default is Content is served for the fallback locale if content is not available for the current locale. |
||
|
optional If no locale can be determined, the default locale will be set. If no default locale is defined, the fallback locale is used. |
||
|
required |
||
|
required An arbitrary locale ID.
For example, one that consists of language and country such as |
||
|
optional, for configurations using the Country code such as |
||
|
required, unless a configuration with the Language code such as |
||
|
required, unless a configuration with the An IETF BCP 47 language tag.
|
||
|
optional, default is 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. |
Once multilanguage content entry is enabled, the page editor displays a language dropdown.
When you select a language, dialogs show a language identifier, such as fr
, next to field labels.
This makes it clear what language editors should be entering.
The language identifier is not displayed for the fallback locale, unless the i18n
property is set to true
in the definition of the given dialog.
For example, if your fallback locale is English, you won’t see (en) next to the field label.
Magnolia’s default language selector is a dropdown, but you can implement alternatives like tabs for each language if you don’t need a large number of languages.
Manage translated content
This section covers creating, storing, and exporting translated content.
Create translated content
Editors can select a language from the dropdown in the Pages app to enter translations.
Magnolia stores translations as language-specific properties (for example, title_en
, title_de
) in a single content hierarchy or as separate nodes if using multiple hierarchies.
Store localized content
Magnolia stores translated content in the JCR repository. By default, translations are stored in a single content hierarchy as properties with language suffixes.
Example: A Text and Image component translated into English, German, and French.
content:
00:
01:
imageLocation: left
subtitle: Translation
subtitle_de: Übersetzung
subtitle_fr: Traduction
text: <p>Translation of the user interface text is a community-supported project.</p>
text_de: <p>Übersetzung der Benutzeroberfläche Text ist eine Gemeinde unterstützt das Projekt.</p>
text_fr: <p>Traduction du texte de l'interface utilisateur est un projet soutenu de la communauté.</p>
You can disable single-hierarchy storage and create separate site hierarchies for each locale. See [one-hierarchy-or-many] or Multilanguage structure.
Export and import translations
The Content Translation Support module allows you to export page content to CSV or Excel, translate it, and re-import it.
-
In the Pages app, select a page and export it using the Content Translation Support module.
-
Translate the content in the exported CSV/Excel file.
-
Re-import the file to update translations.
One hierarchy or many
Magnolia’s default strategy stores translations in a single JCR content node, using language-specific properties (such as subtitle_de
).
Alternatively, you can create separate site hierarchies for each locale for region-specific structures.
See Multilanguage structure for guidance on choosing a strategy.
Serve localized URLs
Magnolia serves translated content at language-specific URLs, such as mysite.com/de/welcome.html
.
Configure language-specific URLs
Enable i18n content support in /server/i18n/content
.
server:
i18n:
system:
content:
enabled: true
class: info.magnolia.module.site.i18n.SiteI18nContentSupport
authoring:
Property | Description |
---|---|
|
required, default is Enables multilanguage content storage and delivery. |
|
required Class that implements info.magnolia.cms.i18n.I18nContentSupport such as:
|
Localized content is served at URLs identifying the locale:
Locale | URL |
---|---|
Default locale |
|
German |
|
French |
|
Spanish |
|
The HTML element on public pages identifies the language with standard lang
and xml:lang
attributes.
<!DOCTYPE html>
<html xml:lang="en" lang="en" class="no-js">
Redirect to localized URLs
Magnolia doesn’t redirect visitors to the localized URL automatically. Configure this behavior on your web server using strategies like:
-
Dropdown selection: Allow visitors to select a language/region.
-
IP-based detection: Redirect based on the visitor’s origin.
-
Browser settings: Detect the visitor’s preferred locale from their browser settings, then redirect them to the localized site.
UTF-8 character encoding
Magnolia supports UTF-8 character encoding for Unicode, enabling non-ASCII characters in page names and content.
To enable UTF-8 page names:
-
For JBoss AS, add the following to
standalone.xml
ordomain.xml
after theextensions
section:standalone.xml or domain.xml<system-properties> <property name="org.apache.catalina.connector.URI_ENCODING" value="UTF-8"/> <property name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING" value="true"/> </system-properties>
-
Enable Unicode support in Magnolia:
magnolia.properties# Activate UTF-8 support to pages magnolia.utf8.enabled=true (1)
1 This allows non-ASCII characters in node names. The value must be the same on both the author and public instance. Publication between instances with a different UTF-8 setting is not supported.
Sites built using Magnolia Templating Essentials templates declare UTF-8 encoding with:
<meta charset="utf-8">
Example: Al Arabiya, an Arabic-language site built with Magnolia, uses UTF-8 for right-to-left cursive script.