How to write I18N exceptions with compound messages

This section shows how to write compound messages with smartics-exceptions.

This library uses ICU4J for message formatting. Please refer to MessageFormat for detailed information about supported formatting features.

Provide a Message Bundle

Here is a sample message bundle with compound messages:

1000.title={faultCount,plural,\
  =0{No Faults.}\
  =1{One Fault.}\
  other{# Faults!}\
 }
1000=The service has encountered {faultCount,plural,\
  =0{no faults}\
  =1{one fault}\
  other{# faults}\
 }.

Message Place Holder

The relevant part of the exception or message bean class looks like this:

/**
 * Count of faults.
 *
 * @serial
 */
@MessageParam
private final int faultCount;

Dependent on the value of faultCount the appropriate message text is selected.