Re: [sugar] Localized number formatting
Hi Ben Did you make any progress with this? Thanks Erik On 10/28/07, Benjamin M. Schwartz [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 It appears that the right way to do localized number formatting in Python is locale.format(). Has anyone successfully used this function in an activity? I can't seem to make it work. Also, what is the correct way to tell a sugar-jhbuild instance that it should pretend to be in Peru, or wherever? - --Ben -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHJSpDUJT6e6HFtqQRAidGAJ4g+0iN+WWsvng/ub2lAV3Tj9nTrgCfTLat u8UKrLcx52ouxqbWVDH0PGQ= =rn8w -END PGP SIGNATURE- ___ Sugar mailing list Sugar@lists.laptop.org http://lists.laptop.org/listinfo/sugar ___ Sugar mailing list Sugar@lists.laptop.org http://lists.laptop.org/listinfo/sugar
Re: [sugar] Localized number formatting
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Erik Blankinship wrote: Did you make any progress with this? Yes. It works. For example, Acoustic Tape Measure calls 'import locale' at the top of the file. During __init__(), after calling activity.Activity.__init__, it initiates locale with 'locale.setlocale(locale.LC_ALL, '')'. Numbers are then formatted using 'locale.format(%.2f, x)'. For more info, see http://docs.python.org/lib/module-locale.html Note that locale.format will localize the decimal separator and thousands separator, but does not change the numerals used. It seems that no one has ever attempted systematic numeral localization in Python. For printing dates and times in the Clock activity I used time.strftime. The time.strftime function provides similar automatically localized formatting. - --Ben -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHL1YBUJT6e6HFtqQRAqWcAKCOOcS/N+5FhHLSzYtS3Z2Pw0F8CgCfazSF brb3JLcq66ZlMgx3+aoLKLc= =Tv26 -END PGP SIGNATURE- ___ Sugar mailing list Sugar@lists.laptop.org http://lists.laptop.org/listinfo/sugar
[sugar] Localized number formatting
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 It appears that the right way to do localized number formatting in Python is locale.format(). Has anyone successfully used this function in an activity? I can't seem to make it work. Also, what is the correct way to tell a sugar-jhbuild instance that it should pretend to be in Peru, or wherever? - --Ben -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHJSpDUJT6e6HFtqQRAidGAJ4g+0iN+WWsvng/ub2lAV3Tj9nTrgCfTLat u8UKrLcx52ouxqbWVDH0PGQ= =rn8w -END PGP SIGNATURE- ___ Sugar mailing list Sugar@lists.laptop.org http://lists.laptop.org/listinfo/sugar