> Would be nice :-) > Many currencies use 2 fractional digits, but there would be about 65 currencies that need different treatment, and would benefit from that kind of fix > (see currencyData/fractions in > http://unicode.org/repos/cldr/trunk/common/supplemental/supplementalData.xml )
The current behavior should pick up all the non-2 fractional digits -- it looks up the number of fractional digits for that currency, and then sets the min/max to that number. The way I put in my CL basically does the work of setCurrency() except manually. I guess it would be best to check first if the currency is valid -- if so, use setCurrency(), if not, set the max/min fractional digits to their defaults. Thanks for the help. Chris On Fri, Jul 17, 2015 at 1:35 PM, Mihai Niță <[email protected]> wrote: > > Do you think we should switch over to that instead of doing it manually, > like in my CL? > > Would be nice :-) > Many currencies use 2 fractional digits, but there would be about 65 > currencies that need different treatment, and would benefit from that kind > of fix > (see currencyData/fractions in > > http://unicode.org/repos/cldr/trunk/common/supplemental/supplementalData.xml > ) > > > > Also, for future reference: for any future changes to the i18n stuff, > > would you like to be the primary reviewer? > > Or should I have someone who works on V8 be the primary reviewer & cc > > you on the review as well? > > I think v8 primary + Cira / me in cc is just fine. > Basically the way you did for this one :-) > > Thank you, > Mihai > > On Fri, Jul 17, 2015 at 10:09 AM, Chris Nardi <[email protected]> > wrote: > >> > > I saw on NumberFormat/DecimalFormat there is a setCurrency() >> method... >> > > but I couldn't tell if that actually impacted the fractional digits. >> > >> > Yes, it does :-) >> >> Do you think we should switch over to that instead of doing it manually, >> like in my CL? >> >> Also, for future reference: for any future changes to the i18n stuff, >> would you like to be the primary reviewer? Or should I have someone who >> works on V8 be the primary reviewer & cc you on the review as well? >> >> Chris >> >> On Fri, Jul 17, 2015 at 12:12 PM, Mihai Niță <[email protected]> wrote: >> >>> > And sorry for passing you up on the review >>> >>> Don't worry :-) >>> >>> >>> > I wasn't sure if you were still contributing to Chromium/V8 >>> >>> I do / don't. Not part of my job now, but if I can help... >>> >>> >>> > I saw on NumberFormat/DecimalFormat there is a setCurrency() method... >>> > but I couldn't tell if that actually impacted the fractional digits. >>> >>> Yes, it does :-) >>> double value = 54306.4047970; >>> NumberFormat cf = NumberFormat.getCurrencyInstance(ULocale.US); >>> System.out.println(cf.format(value)); >>> cf.setCurrency(Currency.getInstance("JPY")); >>> System.out.println(cf.format(value)); >>> (Java because I was lazy, but C++ does the same) >>> >>> Gives: >>> $54,306.40 >>> ¥54,306 >>> >>> >>> Mihai >>> >>> >>> On Fri, Jul 17, 2015 at 9:05 AM, <[email protected]> wrote: >>> >>>> On 2015/07/17 16:02:39, mnita wrote: >>>> >>>>> Apologies, I have missed the line above [ if (style == >>>>> UNICODE_STRING_SIMPLE("currency")) ] >>>>> :-( >>>>> >>>> >>>> Puzzling thing is: why do we even have to do this? >>>>> ICU gives the right results, I have tested it outside v8. >>>>> I should probably download + build v8 and see what's going on. >>>>> Just reading this code does not seem enough for me, right now. >>>>> Or it is just Friday morning, and my brain is not fully awake... >>>>> >>>> >>>> Good morning. :) And sorry for passing you up on the review, I wasn't >>>> sure if >>>> you were still contributing to Chromium/V8. I'll make sure to send any >>>> further >>>> patches your way. >>>> >>>> I think it's because we only pass the locale to ICU, not the currency. >>>> I saw on >>>> NumberFormat/DecimalFormat there is a setCurrency() method... but I >>>> couldn't >>>> tell if that actually impacted the fractional digits. I figured this >>>> would be an >>>> okay way of doing it, but if there's a better way... >>>> >>>> https://codereview.chromium.org/1231613006/ >>>> >>> >>> >> > -- -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev --- You received this message because you are subscribed to the Google Groups "v8-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
