Versions Compared

Key

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

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.

Table of Contents

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 ui-admincentral and ui-framework .

...

Generic i18n keys and their list - 5 UI

The Contacts app doesn't provide the text for either button in its own message bundle. They are provided in the module-ui-framework-messages_en.properties file of the UI-Framework module.

...

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

Mgnl n
actions


Mgnl n
commit


Mgnl p
class

info.magnolia.ui.form.action.SaveFormActionDefinition

Mgnl p
implementationClass

info.magnolia.contacts.app.form.action.SaveContactFormAction

Mgnl n
cancel


Mgnl p
class

info.magnolia.ui.form.action.CancelFormActionDefinition

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

...

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  [brackets] can be omitted.

Apps

  • <app>.app[.label]

App launcher group

  • app-launcher.<groupName>[.label]

Sections

  • <app>.[<subapp>.]actionbar.<section>[.label]
  • [<app>.][<subapp>.]actionbar.sections.<section>[.label]

(warning) If used in the key, <subapp> requires <app>.

Actions

  • [<app>.][<subapp>.]actions.<action>[.label]

Columns

  • [<app>.][<subapp>.]views.[<view-type>.]<column>[.label]

(warning) If used in the key, <subapp> requires <app> .

Dialogs

  • <module>.<dialogPath>[.label]
  • dialogs.<dialogPath>[.label]

Chooser dialogs

  • Generic: dialogs.chooseDialog[.label]
  • App-specific: <app>.chooseDialog[.label]
  • Action-specific: dialogs.<action>[.label]

Tabs

  • <module>.<dialogPath>.<tab>[.label]
  • tabs.<tab>[.label]

Fields

  • [<module>.]<dialogPath>.[<tab>.]<field>[.label]
  • [<module>.]<dialogPath>.[<tab>.]<field>.description
  • <tab>.<field>[.label]
  • <tab>.<field>.description
  • fields.<field>[.label]
  • fields.<field>.description
Info

A note on field validators

The generic i18n key form for a field validator is validators.<validatorName>.errorMessage .

If a validator is defined for the field, the i18n keys may take the validator suffix:

  • [<module>.]<dialogPath>.[<tab>.]<field>.validation.errorMessage
  • <tab>.<field>.validation.errorMessage
  • fields.<field>.validation.errorMessage

Templates

Pages/components

    • [<module>.]templates.<templatePath>
    • [<module>.]templates.<templatePath>.description

Areas

    • templates.areas.<areaName>
    • templates.areas.<areaName>.description