Types of M2M2 modules

Many types of functionality can be implemented in a module, and new possibilities are being introduced regularly. And, any combination of functionalities can be included in a single module.

Themes

One of the simplest modules to write is a 'theme'. This uses CSS stylesheets to override the standing M2M2 design. To affect your style sheets, add references them using the styles property of the module.properties file. File references are relative to the module root directory.

Translations

Another relatively simple type of module functionality is a language translation. These are implemented by creating translation property files. All text displayed in M2M2 is done so by reference, not with literal text. For example, it is common in a JSP file to see the following:

<m2m2:translate key="my.text.reference"/>

The key "my.text.reference" is a sample value. In a translation file somewhere, there may be the following entry:

my.text.reference=The real text that i want to display

In this case, the translate tag would be replaced with the text, and the user would see "The real text that i want to display".

Translation files must have a base name of i18n.properties. To distinguish the language that a translation file provides, the name is supplemented with the locale code, for example i18n_en.properties. To provide regionalized translations, file names can also provide a region code, for example i18n_en_CA.properties. So, to provide, say, a Spanish translation you would create the file i18n_es.properties, and enter the Spanish translations for all necessary references. This file should be placed in the classes folder of the module.

All translations should provide a locale.name value, which is the name of the language within that language itself. For example, for German the value would be "Deutsch". This value is used in the language selection menu in the application. For the value to appear in the language selection, though, the module.properties file must contain a locales value for the language. (For German, the entry would be locales=de.)

Definition classes

Most other functionality that modules can provide is coded with Java. The classes entry in the module.properties file provides M2M2 with the list of classes that define the provided functionality. Definition classes are instantiated and inspected upon startup.

Definition class Javadocs

Email content

Not yet available