Versions Compared

Key

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

Table of Contents
maxLevel2

messageUtils.pl

Overview

messageUtils.pl is a simple perl script which can be helpful in managing messages.properties files.  It provides two basic features:

...

The script can be found here: http://sourcesvn.openmrs.org/browse/openmrs-contrib/utilities/messageUtils/

Disclaimer: This script has only been used on a single module to date, and is not foolproof.  The script writes all its changes to a separate output file, and I recommend reviewing the outputs before replacing any existing .properties files. Also, make sure to read the limitations of the script as documented below.

...

To find unused message codes, run messageUtils with the following parameters:

Code Block

messageUtils.pl -s [MESSAGE_FILE] [TARGET_DIRECTORY] [OUTPUT_FILE]

...

To compare the message codes in two files from different locales, run messageUtils with the following parameters:

Code Block

messagesUtils.pl -c [MESSAGE_FILE] [TARGET_FILE] [OUTPUT_FILE]

...

messages.properties:

Code Block

general.man=Man
general.woman=Woman
general.hot=Hot
general.cold=Cold

messages_es.properties:

Code Block

general.hot=Caliente
general.man=Senior

Running "messageUtils.pl -c messages.properties messages_es.properties messages_es_output.properties" will result in the creation of the following output file:

Code Block

general.man=Senior
general.hot=Caliente
<!--NOT FOUND-->
general.woman=Woman
general.cold=Cold

...

The script can be found here: httpshttp://sourcesvn.openmrs.org/browse/openmrs-contrib/utilities/messageUtils/Download here.

Usage

No Format
usage: Usage: messageUtils.groovy [options] /path/to/folder/with/messages/
              /path/to/openmrs/source/
 -h,--help              Show this help information
 -l,--locale <locale>   Specify locale for messages to be scanned
 -m,--missing-only      Only list missing message codes (used in source,
                        but not defined)
 -s,--summary           Show summary stats
 -u,--unused-only       Only list unused message codes (defined, but never
                        used in source)

...