Localizing Properties with a Finite Number of Values

This chapter shows, by means of a sample, how to localize the values of a property with a finite number of values.

As our sample property we choose request workflow activity state. The state of an activity is one of

  • FAILED.ABORTED

  • FAILED.EXPIRED

  • RUNNING

  • SUCCEEDED

First, define a message prefix for the property, let’s say

  • requestwf.activitystate

The prefix should be unique in file text.properties.

Then, for each supported language, assign a localized text to each property value in file

WEB-INF/classes/resources/languages/<language>/text.properties.

The key for each value is

<message prefix>.<lower case property value>.

Let’s for example define the following english texts for the workflow activity states:

  • requestwf.activitystate.failed.aborted = Cancelled

  • requestwf.activitystate.failed.expired = Expired

  • requestwf.activitystate.running = Running

  • requestwf.activitystate.succeeded = Succeeded

Finally, assign the prefix to the messagePrefix attribute of each form-property and data-property element for the property, e.g.

<form-property name="actstate" readonly="true"
    type="java.lang.String" label="requestwf.activitylist.state"
    width="180" messagePrefix="requestwf.activitystate"/>

and

<data-property name="actstate"
    type="java.lang.String" label="requestwf.activitylist.state"
    sortIndexes="3,0"  width="14%" messagePrefix="requestwf.activitystate"/>