How To Add Localizable Text Messages

Text displayed in Mifos needs to be localizable into multiple languages. This is the case both for text in web pages and text messages coded into the java application.

When a new text message needs to be displayed, rather than adding a hard coded text string to a web page or java code, we add a property key and value to a properties file and reference that message from the web page or java code. Please read the page AdminOnlineTranslationHOWTO for background on this and in particular see the "Adding new keys" section.

Currently jsp pages reference text messages using a custom tag library. For example:

<mifos:mifoslabel name="admin.office" bundle="adminUIResources" />

would reference the key "admin.office" in the resource bundle adminUIResources.properties.

In Java code all, properties can be referenced like this:

MessageLookup.getInstance().lookup("admin.office");

In this case the particular bundle that the message is in is not specified (since they are all merged together).

The techniques above represent the "old way" of doing things in the Mifos code base. Going forward as we move towards our target Cheetah architecture, there will be a different way to accomplish the same thing in Freemarker pages and in Java code. Once we have established our new patterns, they will be documented here.