Thanks Jitin. My results were also on macOS (10.14 and 10.15). I don't know where macOS gets its definitions of the locales, but they are clearly wrong.
I checked the glibc sources and they seem to have it right, as you reported. Still it seems that the hi_IN locale uses three digits grouping for non monetary values, in contrast to what seems to be common practice. Looking into this has been an interesting learning experience. Cheers, Dan On 01/07/2020 12:37, jitin wrote: > I get the same thing on my mac with 'hi_IN.ISCII-DEV'. The > monetary=False one must be incorrect. As far as I can see > locale.localeconv()["grouping"] gives [2,3,0], whereas > locale.localeconv()["mon_grouping"] returns [3,2,0] which is the correct > one. > > On Ubuntu, with 'hi_IN.UTF-8', I get "mon_grouping" of [3, 2, 0] (which > is correct/expected), and "grouping" of [3, 0] which means > 1,000,000,000, etc. > > But the grouping of [2,3,0] (1,00,000,000, etc.) definitely looks > incorrect. > > The following on my mac gives me the same result: > > > export LC_ALL="hi_IN.ISCII-DEV" > > locale -ck mon_grouping # gives 3;2 > > locale -ck grouping # gives 2;3 > > > Looks like it's defined this way: > https://opensource.apple.com/source/adv_cmds/adv_cmds-68/usr-share-locale.tproj/numericdef/hi_IN.ISCII-DEV.src.auto.html > > I'm not sure why that is so. > > Regards, > Jitin > > On Wednesday, 1 July 2020 07:50:10 UTC+5:30, Daniele Nicolodi wrote: > > On 30/06/2020 16:45, jitin wrote: > > I'm not sure about other locales, but in practice, for hi_IN almost > > everything is expressed with that notation, not just monetary values. > > Interesting. Does the locale definition on your OS do the right thing? > For example, what are the results you obtain for the Python code below? > > locale.setlocale(locale.LC_ALL, locale.normalize('hi_IN')) > print(locale.format_string('%f', 1.0e6, grouping=True, monetary=False)) > print(locale.format_string('%f', 1.0e6, grouping=True, monetary=True)) > > I get: > > 10,000,00.000000 > 10,00,000.000000 > > but it is unlikely that this is right, looks like a bug to me. > > Thank you! > > Cheers, > Dan > > -- > You received this message because you are subscribed to the Google > Groups "Beancount" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beancount/bb63e8c2-ea63-4988-b464-76f6948becb7o%40googlegroups.com > <https://groups.google.com/d/msgid/beancount/bb63e8c2-ea63-4988-b464-76f6948becb7o%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/e266c9aa-335a-b6ae-a755-31d9d0e97e2f%40grinta.net.
