From: Eric F. <ef...@ha...> - 2008-01-09 18:12:00
|
Michael Droettboom wrote: > Thanks for the patch. However, perhaps a more general solution would be > to use the Python locale module to format numbers according to different > locales. And expose a kwarg select between the user's preferred locale, > the current U.S. English-centric defaults as they are now, or an > arbitrary locale using an ISO language code. That seems like it could > be a better long-term solution, since there are different number formats > all over, not just in Germany. > > All that said, internationalization is hard -- especially for us > sheltered people in the U.S. where the defaults are most often correct. > I may be missing an important detail here. > > Cheers, > Mike Mike, I agree that this problem needs to be solved. I was looking at it a year or so ago, with the idea of putting in simple options rather than full internationalization, but I never followed up on it. Until your message I had never looked at the documentation for the locale module. It *might* be possible to fix the formatters by replacing a few "somestring % variables" constructs with calls to locale.format_string(somestring, variables)--but this is new in python 2.5. Without this it looks like it might be much harder. The formatter code is already a bit convoluted because of all the variations--latex, mathtex, plain, with or without scientific notation. Actually, I think the option I was looking at a year ago was what is handled by the "grouping" arg in locale.format_string--the ability to use commas or dots to break up triplets of digits. Eric |