"Craig R. McClanahan" wrote:
>
> As Struts get used in more and more environments, we run into the bleeding edges
> once in a while. One place that was recently discovered is that some
> application servers insist on application scope beans (i.e. servlet context
> resources) being Serializable under certain circumstances. (Note -- this is not
> a spec requirement issue; it is a container-specific restriction).
>
> The Struts example application is not going to work in such an environment,
> because of the way that the pseudo-database is architected and used. However, a
> more serious issue is that the MessageResources class (used to store the
> application resources for your internationalized message strings) is not
> Serializable, and it cannt be made so -- because the underlying
> java.util.ResourceBundle family of classes are not Serializable.
>
> There is an additional headache that is caused by the current implementation --
> it relies on loading properties files to initialize the message strings. For
> languages that use ISO-8859-1 character sets, that is pretty easy -- just edit
> the files with a text editor and you are done. For other character sets,
> however, you have to remember to run "native2ascii" on the properties files
> after editing.
>
> To deal with both of these problems, I propose to create a new MessageBundle
> class, which will be Serializable. The external API will be very much like
> MessageResources, so minimal code changes will be required. The key difference
> will be in how it is initialized. I propose to load the messages from an XML
> file (so that you can declare the character set, and use an XML-based editor).
> For the Struts example app, the file would look like this:
>
> <?xml version="1.0" encoding="ISO-8859-1" ?>
>
> <!DOCTYPE struts-messages PUBLIC
> "-//Apache Software Foundation//DTD Struts Messages 1.0//EN"
> "http://jakarta.apache.org/struts/dtds/struts-messages_1_0.dtd">
>
> <struts-messages default="en_US">
>
> <!-- Messages for US English -->
> <locale locale="en_US" xml:lang="en-US">
> <message name="button.cancel" value="Cancel"/>
> <message name="button.confirm" value="Confirm"/>
> ...
> </locale>
>
> <!-- Messages for Spanish -->
> <message name="button.cancel" value="..."/>
> <message name="button.confirm" value="..."/>
> ...
> <locale locale="es" xml:lang="es">
> ...
> </locale>
>
> </struts-messages>
>
> The existing mechanism (MessageResources) would remain available in 1.0 for
> backwards compatibility, but would be deprecated in favor of MessageBundle in
> future versions.
>
> What do you think?
TMX looks like it might make sense for the XML format:
http://www.lisa.org/tmx/
There is a DTD and a link to an article describing its use from
Java, including code for a TMXResourceBundle class.
Regards,
Louis Tribble
--
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Louis Tribble [EMAIL PROTECTED]
Metamata, Inc. http://www.metamata.com
Tools for serious Java developers. +1 510 796 0915
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>