Re: Anybody familiar with ChoiceFormat? Issue 44659
Stefan Bodewig wrote: On Fri, 22 Aug 2008, Matt Benson [EMAIL PROTECTED] wrote: 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. I am one of those people and to me it is more confusing to have Ant use German number formatting but say minutes instead of Minuten. (well, would be since I haven't seen builds taking 1000 minutes myself). When copying files we don't use a number format at all and thus end up with a pure number without any separators at all. I wouldn't expect that too many builds take tens of thousands of minutes so a number with or without thousands separator may be as readable as the other in out case. AFAICT making the thousands separator go away takes the same amount of coding effort as making it use the US locale. I use a logger that tells me when the build finished; this is so that when I switch to different windows and back I can see if a build was recent or not. There's a good case for making the date/time info localised, if you want to do everything properly. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Anybody familiar with ChoiceFormat? Issue 44659
--- Stefan Bodewig [EMAIL PROTECTED] wrote: On Mon, 25 Aug 2008, Matt Benson [EMAIL PROTECTED] wrote: --- Stefan Bodewig [EMAIL PROTECTED] wrote: AFAICT making the thousands separator go away takes the same amount of coding effort as making it use the US locale. Agreed wrt required effort; I also agree that no thousands separator is preferable to ambiguity. I had shown a way to get rid of the thousands separator in my initial post and just forgot about it. It's gone now. The thing about using a pattern of #s big enough to accommodate Long.MAX_VALUE / 6? Another option is to provide localization bundles, but that's obviously a MUCH larger task. ;) And something I wouldn't want to do. I remember that I had a hard time when I first encountered a localized AIX system and my terminal told me there was a Rundsendenachricht von root - it took me pretty long to translate that back into broadcast message and understand what the message was supposed to say. Damned Americans. :) -Matt 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]
Re: Anybody familiar with ChoiceFormat? Issue 44659
On Tue, 26 Aug 2008, Matt Benson [EMAIL PROTECTED] wrote: --- Stefan Bodewig [EMAIL PROTECTED] wrote: I had shown a way to get rid of the thousands separator in my initial post and just forgot about it. It's gone now. The thing about using a pattern of #s big enough to accommodate Long.MAX_VALUE / 6? Yep. Stefan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Anybody familiar with ChoiceFormat? Issue 44659
On Fri, 22 Aug 2008, Matt Benson [EMAIL PROTECTED] wrote: 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. I am one of those people and to me it is more confusing to have Ant use German number formatting but say minutes instead of Minuten. (well, would be since I haven't seen builds taking 1000 minutes myself). When copying files we don't use a number format at all and thus end up with a pure number without any separators at all. I wouldn't expect that too many builds take tens of thousands of minutes so a number with or without thousands separator may be as readable as the other in out case. AFAICT making the thousands separator go away takes the same amount of coding effort as making it use the US locale. Stefan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Anybody familiar with ChoiceFormat? Issue 44659
--- Stefan Bodewig [EMAIL PROTECTED] wrote: On Fri, 22 Aug 2008, Matt Benson [EMAIL PROTECTED] wrote: 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. I am one of those people and to me it is more confusing to have Ant use German number formatting but say minutes instead of Minuten. (well, would be since I haven't seen builds taking 1000 minutes myself). When copying files we don't use a number format at all and thus end up with a pure number without any separators at all. I wouldn't expect that too many builds take tens of thousands of minutes so a number with or without thousands separator may be as readable as the other in out case. AFAICT making the thousands separator go away takes the same amount of coding effort as making it use the US locale. Agreed wrt required effort; I also agree that no thousands separator is preferable to ambiguity. Another option is to provide localization bundles, but that's obviously a MUCH larger task. ;) -Matt 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]
Re: Anybody familiar with ChoiceFormat? Issue 44659
On Mon, 25 Aug 2008, Matt Benson [EMAIL PROTECTED] wrote: --- Stefan Bodewig [EMAIL PROTECTED] wrote: AFAICT making the thousands separator go away takes the same amount of coding effort as making it use the US locale. Agreed wrt required effort; I also agree that no thousands separator is preferable to ambiguity. I had shown a way to get rid of the thousands separator in my initial post and just forgot about it. It's gone now. Another option is to provide localization bundles, but that's obviously a MUCH larger task. ;) And something I wouldn't want to do. I remember that I had a hard time when I first encountered a localized AIX system and my terminal told me there was a Rundsendenachricht von root - it took me pretty long to translate that back into broadcast message and understand what the message was supposed to say. Stefan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Anybody familiar with ChoiceFormat? Issue 44659
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 [EMAIL PROTECTED] 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 [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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Anybody familiar with ChoiceFormat? Issue 44659
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]
Re: Anybody familiar with ChoiceFormat? Issue 44659
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]
Re: Anybody familiar with ChoiceFormat? Issue 44659
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]