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 <[EMAIL PROTECTED]> wrote:

> You may be able to call
>
MINUTES_FORMAT.setNumberFormat(NumberFormat.getNumberInstance(Locale.US)).
> 
> -Matt
> 
> --- Stefan Bodewig <[EMAIL PROTECTED]> 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:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > 
> > 
> 
> 
> 
>       
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 



      

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to