ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: [DISC] misc
Date Tue, 10 Apr 2001 07:18:57 GMT
David Rees <d.rees.l@usa.net> wrote:

> On Mon, 2 Apr 2001 11:41:11 +1000 , Tim Vernum wrote:
> 
>>> >And I'd love to see things like <echo> and <fail> extended to
>>> >support multiple messages, something like
>>> >
>>> ><fail>
>>> >  <message lang="en">We need JMF to compile, please install 
>>> it.</message>
>>> >  <message lang="de">Bitte installieren Sie JMF.</message>
>>> ></fail>
>>> >
>>> 
>>> I would rather seen this done as the include of a sub-build file
>>> that defines properties for the messages. For a given location
>>> they can just swap messages.xml files. That is closer to how you
>>> would do it in actual code as well.
>>
>>I would probably put them in a properties file, and it should be
>>fairly simple to write a task that selects and loads the correct
>>properties file based on the current locale.
>>
> 
> I just figured staying in XML would be more consistent. Otherwise we
> should use resources and the built-in Java i18n stuff.

I think Ant will need to use the resource stuff under the covers
anyway - and I agree that hardcoding the messages in build.xml listing
all languages would be silly (what have I been thinking, tss).

Using an XML messages.xml files or something might be using the same
syntactical structure as build files do, but user are probably
familiar with property files anyway.  I have no real preference here.

Maybe Ant should communicate the locale settings in built in
properties to make live easier?  Something like ant.lang, ant.country,
ant.variant and ant.locale, which would be "de", "DE", "EURO" and
"de_DE_EURO" in my case.

That way, you could do something like this

<property file="messages.${ant.lang}.properties" />
<property file="messages.en.properties" />

in your build file and provide messages.en.properties yourself.  Ant
would automatically fall back to "en" if there is no localized message
resource.

Stefan

Mime
View raw message