|mart...@tumbleweed.com||Oct 10, 2001 11:07 pm|
|James Holmes||Oct 11, 2001 3:46 am|
|Young, Wayne||Oct 11, 2001 5:32 am|
|Curt Hagenlocher||Oct 11, 2001 6:31 am|
|SCHACHTER,MICHAEL (HP-NewJersey,ex2)||Oct 11, 2001 9:11 am|
|Craig R. McClanahan||Oct 11, 2001 10:35 am|
|mart...@tumbleweed.com||Oct 11, 2001 11:09 am|
|mart...@tumbleweed.com||Oct 11, 2001 11:25 am|
|Craig R. McClanahan||Oct 11, 2001 1:37 pm|
|Ted Husted||Oct 13, 2001 2:58 am|
|James Holmes||Oct 13, 2001 4:29 pm|
|mart...@tumbleweed.com||Oct 13, 2001 9:33 pm|
|mart...@tumbleweed.com||Oct 13, 2001 9:57 pm|
|Ted Husted||Oct 14, 2001 2:26 am|
|James Holmes||Oct 15, 2001 6:17 am|
|Petr Jiricka||Oct 16, 2001 5:30 am|
|mart...@tumbleweed.com||Oct 16, 2001 3:14 pm|
|Subject:||RE: [PROPOSAL] XMLMessageResources|
|Date:||Oct 11, 2001 11:09:50 am|
Ah. Thanks for letting me know. I guess I was on hiatus when that happened in Commons. ;-) I'd better go take a look at what's there. I'm a Commons committer also, so I should be able to commit to the sandbox.
-- Martin Cooper
At 09:12 AM 10/11/01, SCHACHTER,MICHAEL (HP-NewJersey,ex2) wrote:
In the jakarta-commons-sandbox, there's a folder called "resources" containing Struts MessageResources and some other classes that I was working on, but had to put off for a while.
It seemed before that MessageResources were being factored out of Struts and into jakarta-commons, and if this is still the case (Craig?), I can free up some time now to finish off the remaining code and maybe go 1.0 with it, along with your XmlMessageResources class. Do you have committer access to the sandbox?
The Struts 1.1 TODO list contains the following item:
"XmlMessageResources. Implementation of MessageResources and MessageResourcesFactory that loads message keys and strings from one or more XML resources or files."
I have an implementation of this which I would like to contribute to Struts. The implementation is a drop-in replacement for the existing PropertyMessageResources. In fact, it is derived from it, and so shares the same file naming scheme for locale-specific messages.
Here's a simple example of what an XML message file would look like:
---------- begin example ---------- <?xml version="1.0" encoding="ISO-8859-1"?>
<messages> <message key="validation.username.required">You must enter a username</message> <message key="validation.password.required">You must enter a password</message> <message key="validation.password.match">Confirmation password does not match</message> </messages> ---------- end example ----------
The first line of the example provides a hint as to why I did not attempt to incorporate messages for more than one locale into a single XML file. Messages for different locales may well be specified using different character encodings. In addition, maintaining the messages from each locale in a different XML file avoids loading locales unnecessarily.
To use this implementation, all that is required is to specify the 'factory' init-param in your web.xml file, and to make sure that the 'application' init-param refers to an XML resource.
What do people think about incorporating this into the Struts 1.1 code base?
-- Martin Cooper