ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: Anybody familiar with ChoiceFormat? Issue 44659
Date Sat, 23 Aug 2008 06:39:04 GMT
Looking back at this again, I think having the number
formatted according to the US Locale would be more
confusing than by the default Locale, speaking without
the perspective of a person who typically uses e.g. .
as a thousands separator and , as a decimal separator.
 If it were up to me I'd mark this issue INVALID and
be done with it.  Maybe we should vote on it, though,
since again, I'm in the minority as a US-based Ant
team member (am I the only active US member?).

-Matt

--- Matt Benson <gudnabrsam@yahoo.com> wrote:

> Oops... I was obviously on crack when I wrote that. 
> That's what I get for trying to figure that out in a
> hurry... Sorry!
> 
> -Matt
> 
> --- Matt Benson <gudnabrsam@yahoo.com> wrote:
> 
> > You may be able to call
> >
>
MINUTES_FORMAT.setNumberFormat(NumberFormat.getNumberInstance(Locale.US)).
> > 
> > -Matt
> > 
> > --- Stefan Bodewig <bodewig@apache.org> wrote:
> > 
> > > Hi all,
> > > 
> > > DateUtils.formatElapsedTime returns different
> > > results depending on the
> > > current locale if the time is bigger than 1000
> > > minutes.
> > > 
> > > Under the covers we use a MessageFormat
> > > 
> > >     private static final MessageFormat
> > > MINUTE_SECONDS
> > >              = new MessageFormat("{0}{1}");
> > > 
> > > where {0} is set to be
> > > 
> > >     private static final ChoiceFormat
> > MINUTES_FORMAT
> > > =
> > >             new ChoiceFormat(LIMITS,
> > MINUTES_PART);
> > > 
> > > and MINUTES_PART is
> > > 
> > >     private static final String[] MINUTES_PART =
> > > {"", "1 minute ", "{0,number} minutes "};
> > > 
> > > ChoiceFormat doesn't provide any way to set the
> > > Locale and setting it
> > > on the "outer" MessageFormat doesn't have any
> > > effect.  ChoiceFormat
> > > does provide a getFormats method that return
> > > Object[] and I hoped it
> > > would return the DecimalFormat instance used in
> > the
> > > last case, but it
> > > just returns the same String[] passed in (wonder
> > why
> > > it returns an
> > > Object[]).
> > > 
> > > Setting setGroupingUsed on the choice format
> > doesn't
> > > have any effect
> > > either and I don't see a way to specify either
> the
> > > locale or the
> > > grouping inside the pattern - well, unless I use
> a
> > > pattern like
> > > ############### (Long.MAX_VALUE / 60 / 1000
> should
> > > fit into this).
> > > 
> > > My preference would be to use Locale.US since
> the
> > > text for "minute" is
> > > English anyway.  Does anybody see a cleaner way
> > than
> > > either use the
> > > pattern above or implementing the logic of
> > > ChoiceFormat ourselves?
> > > 
> > > Stefan
> > > 
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > dev-unsubscribe@ant.apache.org
> > > For additional commands, e-mail:
> > > dev-help@ant.apache.org
> > > 
> > > 
> > 
> > 
> > 
> >       
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > dev-unsubscribe@ant.apache.org
> > For additional commands, e-mail:
> > dev-help@ant.apache.org
> > 
> > 
> 
> 
> 
>       
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> dev-help@ant.apache.org
> 
> 



      

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message