Externalized Strings

All string values in UIM documents and JavaScript must be externalized. This aids maintenance and allows the application to be localized. JavaScript, UIM pages and UIM views can reference externalized strings.

The syntax of a properties file is simple. Each line contains a name=value pair, where the name is an arbitrary name for the string (it should not contain the "=" character), and the value is the localized string value. Blank lines and lines beginning with a "#" character are ignored. Externalized Strings contains an example. The syntax is defined by the java.util.Properties class provided with your Java Runtime Environment; you can consult the API documentation for that class for more details.

It is worth noting that the property value will be reproduced in the final application page exactly as you have typed it in the properties file. The value can contain any character from any language and it does not matter if that character is reserved in XML, HTML or anywhere elseit will be safely processed and displayed as you intended in the application.

If you find that you need to enter a character in a property value that you cannot generate from the keyboard, the only one way to do it is to use the Unicode value of that character in a Unicode escape sequence a backslash and a "u" followed by the four-digit hexadecimal character code. For example, if you want to enter a non-breaking space, the corresponding Unicode escaped sequence is "\u00a0". An example of this is included in the sample properties file below.

Figure 1. A Sample Properties File
# Main Titles
MyPage.Title=My First Page
Cluster.User.Title=User Details

# Field labels
Field.FirstName.Label=First Name
Field.Surname.Label=Surname

# Other
Separator=\u00a0

As you can see, using "." characters is a useful way to add some structure to the properties in the file, though it is not a requirement.

When customizing an application, you can customize properties independently of pages and views by adding the appropriately named properties file to your custom component and defining the externalized string properties. You do not need to add the corresponding page or view file to your component and you do not need to redefine any of the properties that you do not want to change.