Hi Craig,
I really don't think the XMLization of the message files is a good idea.
- Putting all the messages in only one file is not judicious as the various
sections are treated by different translators. It's far more easy to give
each of them a different file.
- Also, some languages can use different local character sets. The croatean
message file will use a local character set that will be incompatible with
the japanese one. Putting all them in a single file will not make the task
easier.
- Message bundles files are already used for localization of other
softwares. So translators know how to handle them. I don't want the
translators to use an XML editor to do the work they used to do with their
prefered world processor or editor.
- Property files have a syntax adapted for large blocks of text. You can use
the escape character \ at the end of a line to break a sentence into
multiple lines. I don't think that such a facility is offered under XML
syntax.
- And last, XML syntax is too much verbose and had no advantage here
(translators are frequently paid for the word!).
The real i18n problems with the message files (apart from their format) is
how to track changes between revision, how to check for completeness between
different locale files and how to break them into smaller files (inclusion).
If you really want to include extra information, for instance the default
locale or the xml:lang, just put them in the struts-config.xml file, where
they are used to describe the configuration of the Struts application. But
please, don't try to mix application configuration with application data...
Pierre M�tras
> 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">
>
> ...
>
> </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?