A New Approach to Resource Bundles in Java

Richard Gillam - Language Analysis Systems, Inc.

Intended Audience: Software Engineers, Systems Analysts
Session Level: Intermediate

The ResourceBundle framework in Java has remained essentially unchanged in design since it first appeared in Java 1.1. Most people use Java properties files to specify the contents of a resource bundle, an approach that doesn't work well with non-Latin-based languages and doesn't lend itself well to resource types other than strings. The other approach, ListResourceBundle, specifies resource bundle content in code, which violates the rule against putting localizable content in code. One downside to both forms of resource bundle is that window layouts and other user-interface elements tend to be specified in code, with their textual labels, if anything, separated out into a bunch of separate, unrelated resources. This makes it hard to localize things other than the labels and makes it hard for UI designers and localizers to consider the totality of a window layout of menu bar and effect change without touching code.

This talk will present an alternative approach, built around XML and oriented toward allowing flexible, modular specification of entire user interfaces. The design is flexible enough to allow specification of most of a program's user interface in a form tailored better toward user interface design and divorced from actual Java code. It also allows for more modular program design, allowing module bindings to be specified in data instead of being hard-coded. The framework is simple and can be extended to handle resources of any data type and to allow complex interrelationships between objects to be specified in resource bundles.