Formatting Currency According to Locale

D

Daniele Varrazzo

Hi everybody

Is there any way to make the most of locale.localeconv() in formatting currencies?

I can use many tricks as lc['currency_symbol'],
locale.format('%.*f', (lc['frac_digits'],cash), 1))
€1.427,48

But that presumes many things, such as
lc['mon_grouping'] == lc['grouping'] # format uses the latter value, doesn't he?
lc['p_sign_posn'] == 3 # else i must change the format string,
# maybe building a mapping to order the pieces, splitting + and - cases...

I'm using...
Python 2.3.2 (#49, Oct 24 2003, 13:37:57) [MSC v.1200 32 bit (Intel)] on win32
.... and watching localeconv(), i also see many other not much documented details:
n_cs_precedes, n_sep_by_space...

Is it up to me to write a function to keep all these details into account?

Bye

Daniele
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top