Mifos Internationalization Followup

The work done to support translation of Mifos into French and Spanish for Mifos v1.1 is a good first step towards full internationalization of Mifos, but there is still a good deal of work to be done. This work includes:

  • Reorganization and cleanup of properties files.
  • Refactoring of the classes related to text customization

Reorganization and cleanup of properties files

There are currently many duplicated strings across the properties files that are used in Mifos. The following is an outline of some steps for cleaning up the current state of affairs:

  1. Make properties keys unique across all properties files. Currently the same properties key is used in multiple properties files. In some cases these keys should be collapsed into a single entry but in other cases they will need to remain distinct. All keys could be made unique by doing something as simple as prepending the name of the properties file to each key in a given properties file. By making all keys unique, it would also give the option of loading all files together (for example via Spring) rather than having to load each independently. In current usage most jsp pages explicitly load a properties file. If all keys were unique then all properties files could be preloaded. Note that references to keys would need to be updated in this case to use the new unique names.
  2. Eliminate duplicate entries from properties files. The current properties file include many duplicated strings. These should be merged into shared entries.

Refactoring of the classes related to text customization

  • The MessageLookup class is currently being used as the central point for resolving localized text. In general all localized text should be resolved via a call to MessageLookup. Getting text values through MessageLookup ensures that a custom/override text value (independent of locale) is used if it is defined (which comes from the database) or the localized text from the properties file otherwise.
  • The LookUpValueEntity (LOOKUP_VALUE table), LookUpValueLocaleEntity (LOOKUP_VALUE_LOCALE table) classes were pre-existing classes used in the original internationalization (i18n) work done in Mifos. They are currently being used differently than originally intended as a "bridge" from the previous i18n structure to a new structure. Each LookUpValueEntity now corresponds to a localizable and customizable text value. A LookUpValueEntity contains a "key" retrievable from the getPropertiesKey() method (stored in LOOKUP_NAME column) that is used to resolve it to localized text. The localized text for a given LookUpValueEntity is stored in src/org/mifos/config/localizedResources/LookupValueMessages.properties. In this file (and the corresponding files for each locale) localized text is assigned to each key.
  • Now LookUpValueLocaleEntity is used only as a way to override (customize) the default localized text from a properties file for a given LookUpValueEntity or to hold dynamically created text that is not localized. In this case, the customized text is stored in the LOOKUP_VALUE_LOCALE.LOOKUP_VALUE column.