Magnolia 5.7 reached extended end of life on May 31, 2022. Support for this branch is limited, see End-of-life policy. Please note that to cover the extra maintenance effort, this EEoL period is a paid extension in the life of the branch. Customers who opt for the extended maintenance will need a new license key to run future versions of Magnolia 5.7. If you have any questions or to subscribe to the extended maintenance, please get in touch with your local contact at Magnolia.
This page explains the use of the so-called generic i18n keys or, in other words, keys that can be used simultaneously in more than one specific location, such as in multiple modules, apps and subapps, multiple tabs, or even in multiple views. A list of such keys is provided at the end of this page.
Reusing keys from other modules
At startup, Magnolia creates a global message bundle by reading keys from all
.properties files of all modules in the current project. The global bundle is a virtual bundle, not a physical file. It includes keys from your module and keys from Magnolia's own modules such as
This means that you don't need to provide keys for all UI elements in your app. Keys for commonly reused elements such as buttons and subapps are in Magnolia's own modules. Just reuse the UI element in your app and Magnolia will find the existing key automatically. In simple terms, the shorter the form of the key, the more places it will be applicable to.
Example: The contact edit form has two buttons: Save Changes and Cancel:
Therefore it is not necessary to insert two specific keys such as the following into the
.properties file of the Contacts app:
If your app needs these buttons, just name your actions
Providing a key to other modules or apps
If a key is to be made available to other modules or apps, make the key less-specific, i.e. shorten it, usually by omitting the <module> or <app> part of the key. See the list below for acceptable shorter forms of i18n keys.
Example: The key for the Teaser component in the MTK module (https://demo.magnolia-cms.com/.magnolia/admincentral;#app:resources:detail;/mtk/templates/components/teaser.yaml)
can be shortened just to
By omitting the module name (mtk) in the key, the shorter form can be reused for translation in other modules, e.g. in the Travel-demo (https://demo.magnolia-cms.com/.magnolia/admincentral;#app:resources:detail;/travel-demo/templates/components/teaser.yaml).
Overriding a generic key
There are, however, scenarios when a translation for an element has to be different from the one available in the generic key. In this case the user still has the option to expand the key from its short (generic) form into a longer pattern which specifies the element (i.e. the module, app, subapp, etc.) where the translation should appear. For example, if the key for the Teaser component in the Travel-demo module needed a different translation than that used in MTK, the key can be expanded into a more specific form:
The translation will now be available primarily to the teaser component in the Travel Demo module.
List of generic i18n keys
The parts in
can be omitted.
App launcher group
If used in the key,
If used in the key,
A note on field validators
The generic i18n key form for a field validator is
If a validator is defined for the field, the i18n keys may take the validator suffix:
templates.areas.<areaName> . description