Many Java applications must support internationalization (i18n) of message
strings presented as part of the user interface, or in messages written to
log files. The standard Java APIs offer the
java.util.ResourceBundle
family of classes to support this
requirement; however, these classes have the following limitations that
reduce their usefulness:
ResourceBundle
implementation classes do not implement
the java.io.Serializable
interface, which is required in
some operational environments.The classes in the proposed Resources
package offer solutions
to these two problems, and provide a framework for providing customized
MessageResources
implementations that can access resource strings
from any desired static or dynamically updated collection.
The proposal defines a miniature resources framework consisting of two abstract classes:
java.util.Locale
and a message key.MessageResources
instance.An initial (and default) implementation accesses the required message
strings from Properties files accessed via Class.getResource()
.
These files are named with a base name, plus extensions identifying the
Locale of the contained message strings, in a manner identical to the
java.util.PropertyResourceBundle
class of the standard APIs.
Resource relies on the standard JDK 1.2 (or later) APIs, plus
the Collections
package from Apache Commons.
No external configuration files are utilized.
The four original Java classes (MessageResources
,
MessageResourcesFactory
, PropertyMessageResources
,
and PropertyMessageResourcesFactory
) are an integral
part of the Struts Framework.
However, they have no dependencies on other aspects of Struts.
Once accepted and released as a Apache Commons component, Struts will
be modified to use the Commons version of these classes, and its internal
versions will be deprecated.
The proposed package name for the new component is
org.apache.commons.resources
.
resources
in the
jakarta-commons
CVS repository. All initial committers
are already committers on jakarta-commons
, so no
additional user setups are required.The initial committers on the Resources component shall be Craig McClanahan, Michael Schachter, Jason van Zyl, and Daniel Rall.