i18n won't help much for parsing, but it can of course do the output you're
looking for, though not quite as simply as what I think you're asking.
<i18n:message key="date"> <!-- (where "date" is mapped to "{0,date}" -->
<i18n:messageArg value="<%= new Date() %>"/>
</i18n:message>
<i18n:message key="currency"> <!-- (where "date" is mapped to
"{0,number,currency}" -->
<i18n:messageArg value="<%= 1234/5678 %>"/>
</i18n:message>
I suppose the way to do what you're looking for in a better way would be to
allow the i18n:message tag skip the requirement for "key", and let you just
put "format" directly in there. That would defeat the purpose for
internationalisation unless the format had not actual text in it and
consisted solely of formatting codes, e.g.
<i18n:message format="{0,date}">
<i18n:messageArg value="<%= new Date() %>"/>
</i18n:message>
<i18n:message format="{0,number,currency}">
<i18n:messageArg value="<%= 1234/5678 %>"/>
</i18n:message>
I'd much rather see the above than a i18n:formatDate or whatever, because at
least you provide some additional formatting, e.g. {0,date,medium} vs.
{0,date,short}.
Tim
> -----Original Message-----
> From: James Strachan [mailto:[EMAIL PROTECTED]]
> Sent: Monday, April 23, 2001 11:33 AM
> To: [EMAIL PROTECTED]
> Subject: Re: datetime TAGlib -> FormatTag.java
>
>
> From: "Mark Femal" <[EMAIL PROTECTED]>
>
> > Started to use the Jakarta datetime lib and wanted to suggest a few
> > improvements (nothing earth-shattering here, just some
> small suggestions):
>
> While we're on the subject, I'd quite like there to be
> general 'formatting'
> and 'parsing' tags for all the primitive data types too -
> Date, Datetime,
> Number and currencies.
>
> I was wondering if we could refactor the formatting and
> parsing part of the
> datetime tag library into either another library "format" or
> into the i18n
> library - then leaving the calendar related features in the
> 'datetime' tag
> library?
>
> e.g. it would be nice to be able to do
>
> <format:number value="123.123"/>
> <format:date value="<%= new Date() %>"/>
>
> or maybe the i18n is the natural place for this stuff?
>
> <i18n:formatDate value="<%= new Date() %>"/>
> <i18n:formatCurrency value="<%= 1235 / 6789 %>"/>
>
>
> <James/>
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>