Rules of Message Merges

Message files are merged based on precedence order. As described above there is always a more important main/source message file, and a file which is being merged into it. The second file is called the merge file in the following sections.

The merging rules described below are applied to decide if the <message> and <locale> elements should be merged into the new message file.

Duplicate messages will always be overwritten by the message file in the component with the highest precedence order. The main message file of Rules of Message Merges, and the merge file of Rules of Message Merges, illustrate these rules:

Figure 1. Sample main message file
<messages package="curam.message">
  <message name="ERR_SAMPLE_VALIDATION_MSG">
    <locale country="US" language="en">
      The specified color is not valid.
    </locale>
  </message>
  <message name="ERR_SAMPLE_ERROR_MSG">
    <locale country="US" language="en">
      An external resource is not available.
    </locale>
  </message>
</messages>
Figure 2. Sample merge message file
<messages package="curam.message">
  <message name="ERR_SAMPLE_VALIDATION_MSG">
    <locale country="GB" language="en">
     The specified colour is not valid.
    </locale>
  </message>
   <message name="ERR_SAMPLE_NEW_MSG">
     <locale country="GB" language="en">
       An example of localisation.
     </locale>
   </message>
   <message name="ERR_SAMPLE_REMOVED_MSG" removed="true">
     <locale language="en">
      This message will be removed.
     </locale>
  </message>
</messages>

As a result of the merge process the new message file produced would be:

Figure 3. Resulting Message File
<messages package="curam.message">
  <message name="ERR_SAMPLE_VALIDATION_MSG">
    <locale country="GB" language="en">
      The specified colour is not valid.
    </locale>
    <locale country="US" language="en">
      The specified color is not valid.
    </locale>
  </message>
  <message name="ERR_SAMPLE_ERROR_MSG">
    <locale country="US" language="en">
      An external resource is not available.
    </locale>
  </message>
  <message name="ERR_SAMPLE_NEW_MSG">
    <locale country="GB" language="en">
      An example of localisation.</locale>
    </locale>
  </message>
  <message name="ERR_SAMPLE_REMOVED_MSG" removed="true">
    <locale language="en">
      This message will be removed.
    </locale>
  </message>
</messages>